在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):sindresorhus/gulp-rev开源软件地址(OpenSource Url):https://github.com/sindresorhus/gulp-rev开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-rev
This project is feature complete. PRs adding new features will not be accepted. Make sure to set the files to never expire for this to have an effect. Install
Usageconst gulp = require('gulp');
const rev = require('gulp-rev');
exports.default = () => (
gulp.src('src/*.css')
.pipe(rev())
.pipe(gulp.dest('dist'))
); APIrev()rev.manifest(path?, options?)pathType: Manifest file path. optionsType: baseType: Override the cwdType: Override the current working directory of the manifest file. mergeType: Merge existing manifest file. transformerType: An object with Original pathOriginal file paths are stored at Asset hashThe hash of each rev'd file is stored at Asset manifestconst gulp = require('gulp');
const rev = require('gulp-rev');
exports.default = () => (
// By default, Gulp would pick `assets/css` as the base,
// so we need to set it explicitly:
gulp.src(['assets/css/*.css', 'assets/js/*.js'], {base: 'assets'})
.pipe(gulp.dest('build/assets')) // Copy original assets to build dir
.pipe(rev())
.pipe(gulp.dest('build/assets')) // Write rev'd assets to build dir
.pipe(rev.manifest())
.pipe(gulp.dest('build/assets')) // Write manifest to build dir
); An asset manifest, mapping the original paths to the revisioned paths, will be written to {
"css/unicorn.css": "css/unicorn-d41d8cd98f.css",
"js/unicorn.js": "js/unicorn-273c2c123f.js"
} By default, const gulp = require('gulp');
const rev = require('gulp-rev');
exports.default = () => (
// By default, Gulp would pick `assets/css` as the base,
// so we need to set it explicitly:
gulp.src(['assets/css/*.css', 'assets/js/*.js'], {base: 'assets'})
.pipe(gulp.dest('build/assets'))
.pipe(rev())
.pipe(gulp.dest('build/assets'))
.pipe(rev.manifest({
base: 'build/assets',
merge: true // Merge with the existing manifest if one exists
}))
.pipe(gulp.dest('build/assets'))
); You can optionally call
Sourcemaps and |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论