# html-prefix

> Prefix html template url from selected tags.

Latest version **0.1.1** (published 2017-07-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install html-prefix
pnpm add html-prefix
yarn add html-prefix
bun add html-prefix
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2017-07-05 |
| First published | 2016-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | idler |
| Maintainers | idler_z |
| Keywords | html, url, prefix, path |

## Links

- npm: https://www.npmjs.com/package/html-prefix
- Repository: https://github.com/Justinidlerz/html-prefix
- Homepage: https://github.com/Justinidlerz/html-prefix#readme
- Issues: https://github.com/Justinidlerz/html-prefix/issues
- npm.io page: https://npm.io/package/html-prefix

## Dependencies (2)

- [url-join](https://npm.io/package/url-join.md) ^1.1.0
- [fastparse](https://npm.io/package/fastparse.md) ^1.1.1

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2017-07-05
- 0.1.0 — 2016-09-23

## README

#Html prefix
Prefix html template url from selected tags.

##Install
```javascript
npm install html-prefix
```

##Usage
```javascript
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"

---
_Source: https://npm.io/package/html-prefix · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
