Skip to content

Instantly share code, notes, and snippets.

@brunogarcia
Created September 21, 2015 13:44
Show Gist options
  • Save brunogarcia/4606f98a9f6a4b4dd001 to your computer and use it in GitHub Desktop.
Save brunogarcia/4606f98a9f6a4b4dd001 to your computer and use it in GitHub Desktop.
/*
Clean
Clear files and folders
https://github.com/gruntjs/grunt-contrib-clean
*/
'clean': ['<%= config.dist %>', '<%= config.tmp %>'],
/*
Copy
Copy files and folders.
https://github.com/gruntjs/grunt-contrib-copy
*/
'copy': {
main: {
files: [
{
'expand': true,
'flatten': true,
'src': ['<%= config.dev %>/favicon.ico'],
'dest': '<%= config.dist %>/',
'filter': 'isFile'
},
{
'expand': true,
'cwd': '<%= config.dev %>/assets/',
'src': ['**'],
'dest': '<%= config.dist %>/assets/'
}
]
},
},
/*
Uglify
Minify files with UglifyJS
https://github.com/gruntjs/grunt-contrib-uglify
*/
'uglify': {
my_target: {
files: {
'<%= config.dist %>/assets/js/main.min.js':
[
'<%= config.dev %>/assets/js/vendors/jquery.js',
'<%= config.dev %>/assets/js/vendors/preloadjs.js',
'<%= config.dev %>/assets/js/vendors/soundjs.js',
'<%= config.dev %>/assets/js/main.js'
]
}
}
},
/*
Process HTML
Process html files at build time to modify them depending on the release environment
https://www.npmjs.com/package/grunt-processhtml
*/
'processhtml': {
dist: {
files: {
'<%= config.tmp %>/index.html': ['<%= config.dev %>/index.html']
}
}
},
/*
HTML Min
Minify HTML
https://github.com/gruntjs/grunt-contrib-htmlmin
*/
'htmlmin': {
dist: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: {
'<%= config.dist %>/index.html': '<%= config.tmp %>/index.html'
}
},
},
/*
Cache breaker
Simple cache-breaker, appends a timestamp or md5 hash to any urls
https://www.npmjs.com/package/grunt-cache-breaker
*/
'cachebreaker': {
dev: {
options: {
match: ['main.min.js', 'main.css'],
},
files: {
src: ['<%= config.dist %>/index.html']
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment