]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add livereload for sass files
authorChocobozzz <florian.bigard@gmail.com>
Wed, 2 Dec 2015 21:16:22 +0000 (22:16 +0100)
committerChocobozzz <florian.bigard@gmail.com>
Wed, 2 Dec 2015 21:16:22 +0000 (22:16 +0100)
Gruntfile.js
package.json

index df7958c4f72f7b1188d1b2d797ac794e52e642b2..028a7773d392903958837661610d6a485a047481 100644 (file)
@@ -33,6 +33,12 @@ module.exports = function (grunt) {
         }
       }
     },
+    concurrent: {
+      options: {
+        logConcurrentOutput: true
+      },
+      dev: [ 'watch:livereload', 'watch:sass', 'express:dev' ]
+    },
     copy: {
       dev: {
         cwd: 'node_modules/bootstrap-sass/assets/',
@@ -59,7 +65,7 @@ module.exports = function (grunt) {
           port: 9000,
           node_env: 'development',
           debug: true,
-          background: true
+          background: false
         }
       }
     },
@@ -71,57 +77,28 @@ module.exports = function (grunt) {
       }
     },
     watch: {
-      express: {
-        files: [ paths.main, paths.routes, paths.src ],
-        tasks: [ 'express:dev' ],
-        options: {
-          livereload: true,
-          spawn: false
-        }
-      },
-      dev: {
+      livereload: {
         files: [ paths.jade, paths.css, paths.browserified ],
+        tasks: [ ],
         options: {
-          livereload: true,
-          nospawn: false
+          livereload: true
         }
+      },
+      sass: {
+        files: [ paths.scss ],
+        tasks: [ 'sass:dev' ]
       }
     }
   })
 
-  // Build client javascript and copy bootstrap dependencies
-  grunt.registerTask('build', [], function () {
-    grunt.loadNpmTasks('grunt-sass')
-    grunt.loadNpmTasks('grunt-browserify')
-    grunt.loadNpmTasks('grunt-contrib-copy')
-    grunt.loadNpmTasks('grunt-newer')
+  // Load automatically all the tasks
+  require('load-grunt-tasks')(grunt)
 
-    // TODO: SASS --> newer
-    grunt.task.run(
-      'sass:dev',
-      'newer:browserify:dev',
-      'newer:copy:dev'
-    )
-  })
+  // Build client javascript and copy bootstrap dependencies
+  grunt.registerTask('build', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev' ])
 
   // Start in dev mode (reload front end files without refresh)
-  grunt.registerTask('dev', [], function () {
-    grunt.loadNpmTasks('grunt-sass')
-    grunt.loadNpmTasks('grunt-browserify')
-    grunt.loadNpmTasks('grunt-contrib-watch')
-    grunt.loadNpmTasks('grunt-express-server')
-    grunt.loadNpmTasks('grunt-contrib-copy')
-    grunt.loadNpmTasks('grunt-newer')
-
-    // TODO: SASS --> newer
-    grunt.task.run(
-      'sass:dev',
-      'newer:browserify:dev',
-      'newer:copy:dev',
-      'express:dev',
-      'watch'
-    )
-  })
+  grunt.registerTask('dev', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev', 'concurrent:dev' ])
 
   // Clean build
   grunt.registerTask('clean', [], function () {
index 0cdd11afedbd6f9054ab0a8f95e72bde29c5a4ad..9b92e015268cd8c807c5c70071947d2d3a3a68e4 100644 (file)
@@ -35,6 +35,7 @@
     "express-validator": "^2.11.0",
     "grunt": "^0.4.5",
     "grunt-browserify": "^4.0.1",
+    "grunt-concurrent": "^2.1.0",
     "grunt-contrib-clean": "^0.6.0",
     "grunt-contrib-copy": "0.8.0",
     "grunt-contrib-watch": "^0.6.1",
@@ -44,6 +45,7 @@
     "jade": "^1.10.0",
     "jquery": "^2.1.4",
     "js-yaml": "^3.3.1",
+    "load-grunt-tasks": "^3.3.0",
     "mkdirp": "^0.5.1",
     "mongoose": "^4.0.5",
     "morgan": "^1.5.3",