Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cfware/gulp-rewrite-html-base-href
Rewrite the base href of HTML documents
https://github.com/cfware/gulp-rewrite-html-base-href
Last synced: 29 days ago
JSON representation
Rewrite the base href of HTML documents
- Host: GitHub
- URL: https://github.com/cfware/gulp-rewrite-html-base-href
- Owner: cfware
- License: mit
- Created: 2020-10-02T22:23:18.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-02T22:25:10.000Z (about 4 years ago)
- Last Synced: 2023-12-27T09:04:03.152Z (12 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-rewrite-html-base-href [![NPM Version][npm-image]][npm-url]
Rewrite the base href of HTML documents.
## Usage
```js
import stream from 'stream';
import {promisify} from 'util';import gulp from 'gulp';
import gulpRewriteHtmlBaseHref from 'gulp-rewrite-html-base-href';const pipeline = promisify(stream.pipeline);
export default () => pipeline(
gulp.src('html/**'),
gulpRewriteHtmlBaseHref({
'/dev-prefix/': '/production-prefix/'
})
gulp.dest('build')
);
```## WARNING
This performs simple string replacement on `.htm`, `.html` and `.xhtml` files, no HTML
parsing is attempted. In the above example any match of `href="/dev-prefix/"` will be
replaced with `href="/produciton-prefix/"`.This plugin should be used before HTML minification occurs, removal of the quotes is
enough to prevent this module from working.[npm-image]: https://img.shields.io/npm/v/gulp-rewrite-html-base-href.svg
[npm-url]: https://npmjs.org/package/gulp-rewrite-html-base-href