Skip to content

Instantly share code, notes, and snippets.

@thanpolas
Last active December 18, 2015 02:58
Show Gist options
  • Save thanpolas/5714306 to your computer and use it in GitHub Desktop.
Save thanpolas/5714306 to your computer and use it in GitHub Desktop.
Node Server + Grunt Watch Tasks + Livereload using one command: grunt
module.exports = function (grunt) {
grunt.initConfig({
watch: {
options: {
livereload: true
},
// triggering livereload when the .css file is updated
// (compared to triggering when sass completes)
// allows livereload to not do a full page refresh
styles: {
files: [
'static/styles/*.css'
]
},
stylesSass: {
options: {
livereload: false
},
files: [
'!styles/sass-twitter-bootstrap/',
'styles/**/*.scss'
],
tasks: [
'compass'
]
},
jade: {
files: [
'templates/**/*.jade'
]
},
scripts: {
files: [
'static/scripts/**/*.js'
]
},
images: {
files: [
'static/img/**/*'
]
}
},
open: {
server: {
path: 'http://localhost:' + develPort
}
},
parallel: {
node: {
options: {
stream: true
},
tasks: [{
grunt: true,
args: ['open:server', 'watch']
}, {
cmd: 'supervisor',
// define the folders you want supervisor to watch, use 2nd array key (backend,config)
args: ['--watch', 'backend,config', './']
}]
}
}
});
//
//
// Register tasks and aliases
//
//
grunt.registerTask('node', [
'parallel:node'
]);
grunt.registerTask('default', ['node']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment