大佬教程收集整理的这篇文章主要介绍了如何在grunt-usemin编译期间删除一些javascript,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
angular.module('nglaborcallApp',[ 'ngCookies','ngresource','ngSanitize','ngRoute','server_mocks',// Don't want this line in the production build 'dialogs'
]
然后一部分需要离开的index.html
<!-- build:js({.tmp,app}) scripts/mocks/mocks.js --> <script type='text/javascript'>var mocks = {};</script> <script src='scripts/mocks/jobs.js'></script> <script src='scripts/mock.js'></script> <!-- endbuild -->
所以这可能是2个问题.我在usemin文档中没有看到任何东西,所以我猜测还有一些其他工具,但是我不知道该工具的名称是什么.
你得到一个Grunt Preprocess的副本
npm install --save-dev grunt-preprocess
然后你修改你的GruntFile.js,这样(这是一个有角度的项目,ymMV)
@H_495_9@module.exports = function (grunt) { grunt.loadNpmTasks('grunt-preprocess'); <-- Add this line near the top of the file
将其添加到您的子任务列表中
preprocess : { options: { inline: true,context : { DEBUG: false } },html : { src : [ '<%= yeoman.dist %>/index.html','<%= yeoman.dist %>/views/*.html' ] },js : { src: '.tmp/concat/scripts/*.js' } },
grunt.registerTask('build',[ 'clean:dist','useminPrepare','concurrent:dist','autoprefixer','concat','preprocess:js',// Remove DEBUG code from production builds 'preprocess:html',// Remove DEBUG code from production builds 'ngmin','copy:dist','cdnify','cssmin','uglify','rev','usemin' ]);
// @if DEBUG 'server_mocks',// Won't be included in production builds // @endif
和你现有的HTML代码这样:
<!-- @if DEBUG --> <script src='scripts/mock.js'></script> <!-- Won't be included in production builds --> <!-- @endif -->
以上是大佬教程为你收集整理的如何在grunt-usemin编译期间删除一些javascript全部内容,希望文章能够帮你解决如何在grunt-usemin编译期间删除一些javascript所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。