Last active
August 29, 2015 14:02
-
-
Save andreareginato/13a11cd66a705b2ae749 to your computer and use it in GitHub Desktop.
Excerpt of Grunt file needed to concat CSS and JS files
This file contains 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
grunt.registerTask('build', [ | |
'clean:dist', | |
'copy', | |
'useminPrepare', | |
'concat', | |
'string-replace', | |
]); |
This file contains 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
// Reads HTML for usemin blocks to enable smart builds that automatically | |
// concat, minify and revision files. Creates configurations in memory so | |
// additional tasks can operate on them | |
useminPrepare: { | |
html: '<%= yeoman.app %>/index.html', | |
options: { | |
dest: '<%= yeoman.dist %>', | |
flow: { | |
html: { | |
steps: { | |
js: ['concat'], | |
css: ['concat'] | |
}, | |
post: {} | |
} | |
} | |
} | |
}, | |
// Copies remaining files to places other tasks can use | |
copy: { | |
dist: { | |
files: [{ | |
expand: true, | |
dot: true, | |
cwd: '<%= yeoman.app %>', | |
dest: '<%= yeoman.dist %>', | |
src: [ | |
'views/{,*/}*.html', | |
] | |
}] | |
}, | |
styles: { | |
} | |
}, | |
// add description label of the final result | |
concat: { | |
options: { | |
banner: '/* <%= yeoman.name %> - v<%= yeoman.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */\n\n' | |
} | |
}, | |
// replace pieces of string | |
'string-replace': { | |
dist: { | |
files: { | |
'./': 'dist/**/*.*' | |
}, | |
options: { | |
replacements: [{ | |
pattern: /views\/templates\/default\.html/g, | |
replacement: 'bower_components/<%= yeoman.name %>/dist/views/templates/default.html' | |
}] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment