Articles of grunt usemin

如何使用我自己的选项configurationconcat和uglify与grunt-usemin

例如:我使用下面的当前configurationuglify我的Gruntfile中的JS脚本: uglify: { options: { report: "min", //"gzip", sourceMap: true, preserveComments: false, //"some", "all" }, application: { options: { // expand: true, banner: '<%= app.banner %>', preserveComments: "some" }, src: 'dist/js/application.js', dest: ".tmp/js/application.min.js" }, dependencies: { options: { sourceMap: false }, src: ['dist/js/dependencies.js'], dest: ".tmp/js/dependencies.min.js" }, 我知道,grunt-usemin从useminPrepare gruntfile选项中声明的html文件中的代码块生成src和dest选项,例如: <!– build:js js/app.js –> <script src="js/app.js"></script> <script […]

grunt-bower-install:排除某些组件

我刚刚使用angular-fullstack yeoman生成器创build了一个新的webapp。 我注意到,grunt-bower-install在<!– bower:js –>标记之间的index.html文件中生成了JS bower组件。 <!– bower:js –> <script src="bower_components/jquery/dist/jquery.js"></script> <script src="bower_components/angular/angular.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/affix.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/alert.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/button.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/carousel.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/collapse.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/dropdown.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/tab.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/transition.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/scrollspy.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/modal.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/tooltip.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/popover.js"></script> <script src="bower_components/angular-resource/angular-resource.js"></script> <script src="bower_components/angular-cookies/angular-cookies.js"></script> <script src="bower_components/angular-sanitize/angular-sanitize.js"></script> <script src="bower_components/angular-route/angular-route.js"></script> <!– endbower –> 我如何排除某些引导组件?

Grunt usemin和usemin准备多个目标

从usemin问题看来,usemin和useminPrepare支持最新版本中的多个目标: useminPrepare支持: https://github.com/yeoman/grunt-usemin/pull/162 https://github.com/yeoman/grunt-usemin/pull/206 usemin支持: https://github.com/yeoman/grunt-usemin/issues/57 我试过用以下configuration使用多个目标: useminPrepare: { foo: { dest: 'fooDist', src: ['foo/index.html'] }, bar: { dest: 'barDist', src: ['bar/index.html'] } }, usemin: { foo: { options: { assetsDirs : ['fooDist'] }, html: ['fooDist/**/*.html'], css: ['fooDist/styles/**/*.css'] }, bar: { options: { assetsDirs : ['barDist'] }, html: ['barDist/**/*.html'], css: ['barDist/styles/**/*.css'] } }, 但我收到以下错误: 运行“usemin:foo”(usemin)任务警告:不支持的模式:foo […]

除.spec.js之外的每个.js文件的节点glob模式

我正在寻找一个更好的glob模式usemin,我想find所有的.js文件,但排除.spec.js文件。 到目前为止,我有以下解决scheme。 <script src="components/**/*(.js|!(*.spec.js|*.scss))"></script> 我现在的解决scheme要求我不断添加文件扩展名来排除它们,否则会被拿起来,例如.html文件。 我试图让它只能find.js文件,并从他们排除.spec.js ,但似乎并没有工作。 另外添加!components/**/*.spec.js作为下面的另一个脚本似乎不工作。