0.1.2 • Published 7 years ago
gulp-html-url-prefix v0.1.2
gulp-html-url-prefix
a plugin of gulp for prefix url
install
npm install gulp-html-url-prefix
options
- options - type:
object
- prefix:
string
, default
- prefix:
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