From: Chocobozzz Date: Wed, 2 Dec 2015 21:16:22 +0000 (+0100) Subject: Add livereload for sass files X-Git-Tag: v0.0.1-alpha~1078 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=af82cae07dc568e3cb10acd70113df56eb8b15a9;p=github%2FChocobozzz%2FPeerTube.git Add livereload for sass files --- diff --git a/Gruntfile.js b/Gruntfile.js index df7958c4f..028a7773d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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 () { diff --git a/package.json b/package.json index 0cdd11afe..9b92e0152 100644 --- a/package.json +++ b/package.json @@ -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",