Last active
September 20, 2016 18:41
-
-
Save negativo/fe0ba9767c9adae601b4dbe1d7b40277 to your computer and use it in GitHub Desktop.
Gruntfile with concurrent execution, concat, uglify, cssmin, coffee,less, htmlmin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt){ | |
grunt.initConfig({ | |
coffee: { | |
compile: { | |
options: { | |
bare: true, | |
sourceMap:true | |
}, | |
files: { | |
'public/js/landing.js': 'coffee/landing.coffee', // 1:1 compile | |
} | |
}, | |
}, | |
less: { | |
dev: { | |
options: { | |
paths: ["less"], | |
compress: true, | |
yuicompress:true, | |
optimization: 2, | |
sourceMap: true, | |
sourceMapFilename: 'public/css/maincss.map', | |
sourceMapURL:'maincss.map', | |
sourceMapBasepath:'public', | |
sourceMapRootpath: '/' | |
}, | |
files: [{"public/css/main.css": "less/main.less"}, | |
{"public/css/admin.css": "less/admin.less"}] | |
} | |
}, | |
concat: { | |
mainjs:{ | |
src:[ | |
"public/js/vendor/prefixfree.min.js", | |
"public/js/vendor/modernizr.js", | |
"public/js/vendor/jquery.min.js", | |
"public/js/vendor/d3.min.js"], | |
dest:"public/js/vendor.min.js" | |
}, | |
}, | |
concurrent: { | |
target: { | |
tasks: ['concat','less'], | |
options: { | |
logConcurrentOutput: true | |
} | |
}, | |
target2: { | |
tasks: ['uglify','cssmin'], | |
options: { | |
logConcurrentOutput: true | |
} | |
} | |
}, | |
cssmin: { | |
options: { | |
shorthandCompacting: false, | |
roundingPrecision: -1, | |
sourceMap:true | |
}, | |
target: { | |
files: { | |
'public/css/main.min.css': ['public/css/main.css'], | |
'public/css/vendor/vendor.min.css':[ | |
//"bower_components/roboto-slab-fontface/roboto-slab-fontface.css", | |
//"bower_components/roboto-fontface/css/roboto-fontface.css", | |
//"public/css/vendor/RobotoCondensed.css", | |
], | |
'public/css/admin.min.css': ['public/css/admin.css'], | |
} | |
} | |
}, | |
watch: { | |
styles: { | |
files: ['less/*.less'], | |
tasks: ['less','concat:maincss','cssmin'], | |
options: { | |
nospawn: true | |
} | |
}, | |
js: { | |
files: ['public/js/*.js'], | |
tasks: ['concat:mainjs','uglify'], | |
} | |
}, | |
uglify: { | |
options: { | |
mangle: { | |
except: ['jQuery'] | |
}, | |
sourceMap:'main.min.map' | |
}, | |
js: { | |
files: { | |
"public/js/main.min.js":["public/js/vendor.min.js","public/src/main.js"], | |
} | |
} | |
}, | |
}); | |
grunt.loadNpmTasks('grunt-concurrent'); | |
grunt.loadNpmTasks('grunt-contrib-htmlmin'); | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-cssmin'); | |
grunt.loadNpmTasks('grunt-contrib-less'); | |
grunt.loadNpmTasks('grunt-contrib-coffee'); | |
grunt.registerTask('default',['coffee','concurrent:target','concurrent:target2']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment