Add livereload for sass files

This commit is contained in:
Chocobozzz 2015-12-02 22:16:22 +01:00
parent 3807e27a6d
commit af82cae07d
2 changed files with 21 additions and 42 deletions

View 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' ],
livereload: {
files: [ paths.jade, paths.css, paths.browserified ],
tasks: [ ],
options: {
livereload: true,
spawn: false
livereload: true
}
},
dev: {
files: [ paths.jade, paths.css, paths.browserified ],
options: {
livereload: true,
nospawn: false
}
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 () {

View 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",