html-prefix
v0.1.1
Published
Prefix html template url from selected tags.
Downloads
1
Readme
#Html prefix Prefix html template url from selected tags.
##Install
npm install html-prefix
##Usage
var prefix = require('html-prefix');
var html = '<script src="/js/example.js"></script>';
var prefixUrl = '//example.com/';
var newHtml = prefix(html, {
prefix: prefixUrl
});
console.log(newHtml); //=> <script src="//example.com//js/example.js"></script>
##otions
prefix
: Url prefix path.attrs
: Set the selector to prefix path.
You can set a object, like so:
```javascript
{
'link:href': false, // to cancel the selector
'img:data-href': true // to add the selector
}
```
You can set a array, like so:
```javascript
['img:data-href',...] // to add any selector
```
default selector have "img:src", "img:srcset", "img:data-src", "script:src", "link:href"