zhangaz1 / gulp-rev-orig Goto Github PK
View Code? Open in Web Editor NEWgulp rev for js&css&img path in html without prejudice of other
License: MIT License
gulp rev for js&css&img path in html without prejudice of other
License: MIT License
Hi,
There is a problem with recognition if a file is referenced by relative path. Everything works correct for the first file, but if there are multiple files with relative paths in a row, every second file path is treated as absolute path.
Example:
gulp.task('revOrig-withBase', function(argument) {
gulp.src('test.html')
.pipe(revOrig({
base: 'assets/'
}))
.pipe(gulp.dest('./dist'));
});
for html file with 2 relative reference paths:
<script src="/../assets/index.js"></script>
<script src="/../assets/index.js"></script>
results an single file not found message, and invalid output:
<script src="/../assets/index.js?v=3fffb693"></script>
<script src="/../assets/index.js"></script>
The above can be fixed by removing "g" option from regular expression options in line 13.
var regOption = 'i';
Best regards,
If you import more than 1 script from a CDN, rev will fail on the 2nd one.
Sample html:
<script src="main.js"></script>
<script src="https://apis.google.com/js/platform.js"></script>
<script src="https://apis.google.com/js/platform2.js"></script>
Running rev against it will get a '/home/platform2.js not found error'.
This seems to be triggered by the fact that there are multiple imports in a row. If I add a script import for a local file between those 2 lines, then the file will process fine:
<script src="main.js"></script>
<script src="https://apis.google.com/js/platform.js"></script>
<script src="main.js"></script>
<script src="https://apis.google.com/js/platform2.js"></script>
as will this (note multiple local files in this example):
<script src="main.js"></script>
<script src="main.js"></script>
<script src="https://apis.google.com/js/platform2.js"></script>
My task is barebones:
gulp.task('client.postprocess_html:dist', () => {
return gulp.src('./client/dist/*.html')
.pipe(rev())
.pipe(gulp.dest('./client/dist/'));
});
我在vs项目上使用的时候,在添加版本号上之后,页面会出现乱码的情况,最后发现当出现乱码时,编码格式是utf-8(无签名);而没有乱码时,格式是utf-8(有签名)。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.