Skip to content

Instantly share code, notes, and snippets.

@elyager
Last active August 29, 2015 14:19
Show Gist options
  • Save elyager/fd7774753b05219ceb7c to your computer and use it in GitHub Desktop.
Save elyager/fd7774753b05219ceb7c to your computer and use it in GitHub Desktop.
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
clean: {
js: ['static/build/js'],
css: ['static/css/style.css', 'static/css/vendor/style-autoprefixer.css', 'static/build/css']
},
stylus: {
compile: {
options: {
paths: ['static/styl/'],
compress: false
},
files: {
'static/css/style.css': 'static/styl/style.styl'
}
}
},
autoprefixer: {
dist: {
files: {
'static/css/vendor/style-autoprefixer.css': 'static/css/style.css'
}
},
options: {
browsers: ['last 2 versions', 'ie 8', 'ie 9']
}
},
concat: {
js: {
src: [
'static/js/lib/*.js',
'static/js/main.js'
],
dest: 'static/build/js/production.js'
},
css: {
src: 'static/css/vendor/*.css',
dest: 'static/build/css/production.css'
}
},
uglify: {
my_target: {
options: {
sourceMap: true,
sourceMapName: 'static/build/js/production.map'
},
files: {
'static/build/js/production.min.js': ['static/build/js/production.js']
}
}
},
cssmin: {
css: {
src: 'static/build/css/production.css',
dest: 'static/build/css/production.min.css'
}
},
express: {
options: {
livereload: true,
nospawn: true
},
web: {
options: {
script: 'server.js',
}
},
},
watch: {
web: {
files: ['*.js'],
tasks: [
'express:web'
],
options: {
nospawn: true,
atBegin: true
}
},
js: {
files: ['static/js/*.js'],
tasks: ['clean:js','concat:js', 'uglify'],
options: {
nospawn: true
}
},
css: {
files: ['static/styl/*.styl', 'static/css/vendor/*.css'],
tasks: ['clean:css', 'stylus', 'autoprefixer', 'concat:css', 'cssmin'],
options: {
nospawn: true
}
},
frontend: {
options: {
livereload: true
},
files: [
'static/build/css/*.css',
'static/build/js/*.js',
'static/img/**/*',
'static/fonts/**/*',
'static/bios/**/*',
'views/**/*',
]
}
},
parallel: {
web: {
options: {
stream: true
},
tasks: [
{
grunt: true,
args: ['watch:web']
},
{
grunt: true,
args: ['watch:js']
},
{
grunt: true,
args: ['watch:css']
},
{
grunt: true,
args: ['watch:frontend']
}
]
},
}
});
grunt.registerTask('web', 'launch webserver and watch tasks', ['parallel:web']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment