Skip to content

Instantly share code, notes, and snippets.

@knu2xs
Forked from thanpolas/Gruntfie.js
Created July 25, 2014 16:01
Show Gist options
  • Save knu2xs/c99ce9cfbd07460a7f53 to your computer and use it in GitHub Desktop.
Save knu2xs/c99ce9cfbd07460a7f53 to your computer and use it in GitHub Desktop.
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
express: {
options: {
// Override defaults here
},
web: {
options: {
script: 'backend/app.js',
}
},
},
watch: {
frontend: {
options: {
livereload: true
},
files: [
// triggering livereload when the .css file is updated
// (compared to triggering when sass completes)
// allows livereload to not do a full page refresh
'frontend/static/styles/*.css',
'frontend/templates/**/*.jade',
'frontend/static/scripts/**/*.js',
'frontend/static/img/**/*'
]
},
stylesSass: {
files: [
'!frontend/styles/sass-twitter-bootstrap/',
'frontend/styles/**/*.scss'
],
tasks: [
'compass'
]
},
web: {
files: [
'backend/**/*.js',
'config/*',
'test/**/*.js',
],
tasks: [
'express:web'
],
options: {
nospawn: true, //Without this option specified express won't be reloaded
atBegin: true,
}
}
},
parallel: {
web: {
options: {
stream: true
},
tasks: [{
grunt: true,
args: ['watch:frontend']
}, {
grunt: true,
args: ['watch:stylesSass']
}, {
grunt: true,
args: ['watch:web']
}]
},
}
});
grunt.registerTask('web', 'launch webserver and watch tasks', [
'parallel:web',
'open:server',
]);
grunt.registerTask('default', ['web']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment