0.1.1 • Published 7 years ago

html-prefix v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

#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"