Javascript 如何忽略wiredep路径中的一个字符串
我有三个吞咽任务: 第一个任务-将所有jade文件编译为html,使用bower.json中的wiredep插件插入所有我的css和jsJavascript 如何忽略wiredep路径中的一个字符串,javascript,gulp,bower,wiredep,Javascript,Gulp,Bower,Wiredep,我有三个吞咽任务: 第一个任务-将所有jade文件编译为html,使用bower.json中的wiredep插件插入所有我的css和js /* Compile jade templates to html files in app directory */ gulp.task('jade', function() { gulp.src(config.path.dev.jade + '/index.jade') .pipe(jade({ pretty: '\t'
/* Compile jade templates to html files in app directory */
gulp.task('jade', function() {
gulp.src(config.path.dev.jade + '/index.jade')
.pipe(jade({
pretty: '\t'
}))
.pipe(wiredep({
ignorePath: '../'
}))
.pipe(gulp.dest('./src'))
.pipe(notify(config.message.jadeCompiled))
});
任务后的结果:
<!-- bower:js-->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/nodernizr-dev/modernizr-latest.js"></script>
<!-- endbower-->
<!-- bower:js-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="bower_components/nodernizr-dev/modernizr-latest.js"></script>
<!-- endbower-->
任务后的结果:
<!-- bower:js-->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/nodernizr-dev/modernizr-latest.js"></script>
<!-- endbower-->
<!-- bower:js-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="bower_components/nodernizr-dev/modernizr-latest.js"></script>
<!-- endbower-->
第三个任务-再次使用wiredep插件更改我的生产路径
/* Normalize paths to production */
gulp.task('wiredep', function () {
return gulp.src('./dist/index.html')
.pipe(wiredep({
ignorePath: '../src/bower_components/',
exclude: 'jquery',
fileTypes: {
html: {
replace: {
js: '<script src="js/vendor/{{filePath}}"></script>',
css: '<link rel="stylesheet" href="css/vendor/{{filePath}}" />'
}
}
}
}))
.pipe(gulp.dest('./dist'))
});
我有这个结果
<!-- bower:js-->
<script src="js/vendor/nodernizr-dev/modernizr-latest.js"></script>
<!-- endbower-->
但我只想忽略一个字符串,我的谷歌CDN URL就是这样
<!-- bower:js-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="js/vendor/nodernizr-dev/modernizr-latest.js"></script>
<!-- endbower-->
忽略哪里,忽略什么,不去哪里?在index.html的第…节中,我在本节显示的所有结果块中。什么忽略GoogleCDNjQueryURL中的一个字符串,我在第三个任务后显示了我想要的和收到的内容