gulp-html-url-prefix
0.1.2 • Public • Published
gulp-html-url-prefix
a plugin of gulp for prefix url
install
npm install gulp-html-url-prefix
options
urlPrefix({
prefix: '//cdn.xxx.com'
})
example
index.html
<!DOCTYPE html>
<html>
<head>
<link href="./css/example.css" />
</head>
<body>
<img src="./example.jpg" />
<script type="text/javascript" src="./js/example.js"></script>
</body>
</html>
gulpfile.js
var urlPrefix = require('gulp-html-url-prefix'),
gulp = require('gulp');
gulp.task('url', function() {
gulp.src(['index.html'])
.pipe(urlPrefix({
prefix: '//cdn.xxx.com'
}))
.pipe(gulp.dest('./'));
});
and the result is:
<!DOCTYPE html>
<html>
<head>
<link href="//cdn.xxx.com/css/example.css" />
</head>
<body>
<img src="//cdn.xxx.com/example.jpg" />
<script type="text/javascript" src="//cdn.xxx.com/js/example.js"></script>
</body>
</html>
License
MIT
Package Sidebar
Install
npm i gulp-html-url-prefix
Weekly Downloads