gulp-rewrite-image-path
v0.0.4
Published
Convert and replace src attrs within your data. Based on catindev/gulp-inline-image-path.
Downloads
31
Maintainers
Readme
Convert and replace the src
of the images in your HTML files.
Example
gulpfile.js
var gulp = require('gulp');
var rewriteImagePath = require('gulp-rewrite-image-path');
gulp.task('default', function () {
gulp.src('index.html')
...
.pipe(rewriteImagePath({path:"build/images"}))
...
});
Before:
<html>
<head>
</head>
<body>
<img src="sample1.png" />
<img src="subdirectory/sample2.png" />
<img src="https://www.wikipedia.org/static/favicon/wikipedia.ico" />
...
After:
<html>
<head>
</head>
<body>
<img src="build/images/sample.png">
<img src="build/images/subdirectory/sample2.png" />
<img src="https://www.wikipedia.org/static/favicon/wikipedia.ico" />
...
License
MIT © lagartoflojo