1.0.1 • Published 6 years ago
gulp-assets-replace v1.0.1
Replace new assets to dist file
npm i --save-dev gulp-assets-replace
yarn add --dev gulp-assets-replace
webpack.config.js
const path = require('path')
const gulp = require('gulp')
const rename = require('gulp-rename'),
const assetsReplace = require('gulp-assets-replace')
gulp.task('app', function() {
gulp.src([
"./src/js/app.js",
])
.pipe(rename({suffix: ('.'+Date.now())}))
.pipe(assetsReplace([
path.resolve(__dirname, '../../../remix-server/templates/pc/index.html')
]))
.pipe(gulp.dest('./js/'));
});
before this plugin work,you file may like:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script src="{path}/static/app.125631635361.js"></script>
</body>
</html>
if new assets is:
- app.2894204284928.js
when plugin works done,file will look like:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script src="{path}/static/app.2894204284928.js"></script>
</body>
</html>
Params
Name | Type | Default | Description |
---|---|---|---|
|{Array} |
| an array contains absolute file |