Skip to content

Instantly share code, notes, and snippets.

@hafeez-syed
Created September 17, 2015 00:22
Show Gist options
  • Save hafeez-syed/5c17cdcdf10843796a22 to your computer and use it in GitHub Desktop.
Save hafeez-syed/5c17cdcdf10843796a22 to your computer and use it in GitHub Desktop.
cleanup
var config = require('./config.json')
, files = {
html: "templates/*.html",
js: ["*.js", "js/**/*.js"],
json: ".json",
css: "css/**/*.css"
}
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
temp: ['public/**']
},
browserify: {
'public/js/main.js': ['js/**/*.js']
},
copy:{
html: {
files: [
{
expand: true,
src: ['templates/index.html'],
dest: 'public/',
flatten: true
}
]
},
css: {
files: [
{
expand: true,
src: ['css/**'],
dest: 'public/'
}
]
}
},
concurrent: {
target: {
tasks: ['nodemon', 'watch'],
options: {
logConcurrentOutput: true
}
}
},
nodemon: {
dev:{
script: 'server.js'
}
},
watch: {
js: {
files: files.js,
tasks: [ 'browserify']
},
css: {
files: files.css,
tasks: [ 'copy:css' ]
},
html: {
files: files.html,
tasks: [ 'copy:html' ]
},
livereload: {
options: { livereload: true },
files: ['public/**/*']
}
}
})
grunt.loadNpmTasks('grunt-concurrent')
grunt.loadNpmTasks('grunt-nodemon')
grunt.loadNpmTasks('grunt-browserify')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-copy')
grunt.registerTask('default', ['clean', 'browserify', 'copy', 'concurrent:target'])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment