It seems you need to define your custom block. It will show, for example, creating a custom block "myjs" only with concat.
Gruntfile.js
useminPrepare: { html: '<%= config.app %>/index.html', options: { dest: '<%= config.dist %>', flow: { // i'm using this config for all targets, not only 'html' steps: { // Here you define your flow for your custom block - only concat myjs: ['concat'], // Note that you NEED to redefine flow for default blocks... // These below is default flow. js: ['concat', 'uglifyjs'], css: ['concat', 'cssmin'] }, // also you MUST define 'post' field to something not null post: {} } }, },
You also need to define a block replacement for your custom block. This block should be the same as for js.
Gruntfile.js:
usemin: { options: { assetsDirs: ['<%= config.dist %>', '<%= config.dist %>/images'], blockReplacements: { // our 'replacement block' myjs: function (block) { return '<script src="' + block.dest + '"></script>'; } // no need to redefine default blocks } }, html: ['<%= config.dist %>/{,*/}*.html'], css: ['<%= config.dist %>/styles/{,*/}*.css'] },
So now you can use your new custom block in index.html:
<script src="lib/angular/angular.min.js"></script> <script src="lib/angular-cookies/angular-cookies.min.js"></script> <script src="lib/angular-route/angular-route.min.js"></script> <script src="js/app.js"></script> <script src="js/controllers/LanguageCtrl.js"></script>
Now it should work the way you want. I have not tested this code, but I have a very similar configuration in my application, and it works like a charm. I also had some problems with defining replacement blocks - it was very unpleasant.
Hope this helps!
bez997
source share