什么's负责在此Gulp任务中创建文件名签名
What's responsible for creating the filename signature in this Gulp task?
当我运行gulp build
时,它会创建一个名称如下的文件:
dist/scripts/app-f3c1dbf348.js
f3c1dbf348
部分每次都有所不同。很明显,是什么原因导致了这种情况的发生,但我不清楚是什么原因。
下面是我的gulp/build.js
。生成文件名的f3c1dbf348
部分(如果有的话)是什么?我希望文件名仅为app.js
,因为我连接的.js
文件需要作为Bower组件包含在内。
'use strict';
var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');
var $ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']
});
gulp.task('partials', function () {
return gulp.src([
path.join(conf.paths.src, '/app/**/*.html'),
path.join(conf.paths.tmp, '/serve/app/**/*.html')
])
.pipe($.minifyHtml({
empty: true,
spare: true,
quotes: true
}))
.pipe($.angularTemplatecache('templateCacheHtml.js', {
module: 'lmsComponents',
root: 'app'
}))
.pipe(gulp.dest(conf.paths.tmp + '/partials/'));
});
gulp.task('html', ['inject', 'partials'], function () {
var partialsInjectFile = gulp.src(path.join(conf.paths.tmp, '/partials/templateCacheHtml.js'), { read: false });
var partialsInjectOptions = {
starttag: '<!-- inject:partials -->',
ignorePath: path.join(conf.paths.tmp, '/partials'),
addRootSlash: false
};
var htmlFilter = $.filter('*.html', { restore: true });
var jsFilter = $.filter('**/*.js', { restore: true });
var cssFilter = $.filter('**/*.css', { restore: true });
var assets;
return gulp.src(path.join(conf.paths.tmp, '/serve/*.html'))
.pipe($.inject(partialsInjectFile, partialsInjectOptions))
.pipe(assets = $.useref.assets())
.pipe($.rev())
.pipe(jsFilter)
.pipe($.sourcemaps.init())
.pipe($.ngAnnotate())
.pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', conf.errorHandler('Uglify'))
.pipe($.sourcemaps.write('maps'))
.pipe(jsFilter.restore)
.pipe(cssFilter)
.pipe($.sourcemaps.init())
.pipe($.replace('../../bower_components/bootstrap-sass/assets/fonts/bootstrap/', '../fonts/'))
.pipe($.minifyCss({ processImport: false }))
.pipe($.sourcemaps.write('maps'))
.pipe(cssFilter.restore)
.pipe(assets.restore())
.pipe($.useref())
.pipe($.revReplace())
.pipe(htmlFilter)
.pipe($.minifyHtml({
empty: true,
spare: true,
quotes: true,
conditionals: true
}))
.pipe(htmlFilter.restore)
.pipe(gulp.dest(path.join(conf.paths.dist, '/')))
.pipe($.size({ title: path.join(conf.paths.dist, '/'), showFiles: true }));
});
// Only applies for fonts from bower dependencies
// Custom fonts are handled by the "other" task
gulp.task('fonts', function () {
return gulp.src($.mainBowerFiles())
.pipe($.filter('**/*.{eot,svg,ttf,woff,woff2}'))
.pipe($.flatten())
.pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/')));
});
gulp.task('other', function () {
var fileFilter = $.filter(function (file) {
return file.stat.isFile();
});
return gulp.src([
path.join(conf.paths.src, '/**/*'),
path.join('!' + conf.paths.src, '/**/*.{html,css,js,scss}')
])
.pipe(fileFilter)
.pipe(gulp.dest(path.join(conf.paths.dist, '/')));
});
gulp.task('clean', function () {
return $.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/')]);
});
gulp.task('build', ['html', 'fonts', 'other']);
这是一行:
.pipe($.rev())
相关文章:
- 当使用Watchify时,Browserify+Babelify Gulp任务没有终止
- gulp Iconify任务抛出错误TypeError:Path必须是字符串.收到false
- Gulp Git首先运行提交任务,然后运行推送任务
- Gulp复制任务完成后如何执行通知
- 如何在Gulp任务中拆分文件
- 多个 js 库的 Gulp 任务以及适当的名称
- 如何按特定顺序运行 Gulp 任务
- 如何在GULP任务中循环传递数组
- gulp/webpack任务的输出文件名
- 创建Gulp任务但不起作用,为什么
- 如何通过Gulp任务增加版本号
- 如果满足条件,停止Gulp任务
- Gulp任务似乎运行了两次,而不是一次
- 如何删除失败Gulp任务的调用堆栈
- 将字符串作为参数传递给 gulp 任务
- Gulp Browserify Reactify 任务非常慢
- 当运行 generator-gulp-webapp 的 'build' 任务(使用 gulp-jade)
- 为什么 Gulp 在运行依赖于它的任务之前没有完成我的“清理”任务
- 在使用 GULP 任务将所有 JS 连接到单个 JS 文件中时,在 AngularJS 中出错
- 当我键入 npm start 时如何启动 Gulp 手表任务