Created
November 27, 2013 15:57
-
-
Save rrharvey/7678052 to your computer and use it in GitHub Desktop.
This example shows how to add script elements automatically that will be processed using grunt-usemin. This example uses the html and Gruntfile.js from the AngularJS generator for Yeoman. The default for mode for grunt-file-blocks is to add newly discovered files only. Once a script element has been added you can move the lines around inside the…
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
<!-- ... content removed --> | |
<!-- build:js({.tmp,app}) scripts/scripts.js --> | |
<!-- fileblock:js scripts --> | |
<script src="scripts/app.js"></script> | |
<script src="scripts/controllers/main.js"></script> | |
<!-- endfileblock --> | |
<!-- endbuild --> | |
</body> | |
</html> |
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
// ... content removed | |
// Performs rewrites based on rev and the useminPrepare configuration | |
usemin: { | |
html: ['<%= yeoman.dist %>/{,*/}*.html'], | |
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'], | |
options: { | |
assetsDirs: ['<%= yeoman.dist %>'] | |
} | |
}, | |
// Adds script elements to the HTML file | |
fileblocks: { | |
html: { | |
src: 'app/index.html', | |
blocks: { | |
'scripts': { | |
src: [ | |
'scripts/app.js', | |
'scripts/services/*.js', | |
'scripts/controllers/*.js' | |
], | |
cwd: 'app' | |
} | |
} | |
} | |
}, | |
// ... content removed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment