Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/layflags/srify

Adds computed integrity attributes to same domain external script and stylesheet tags on html markup
https://github.com/layflags/srify

cli html markup nodejs npm script sri style subresource-integrity

Last synced: 11 days ago
JSON representation

Adds computed integrity attributes to same domain external script and stylesheet tags on html markup

Awesome Lists containing this project

README

        

Buy Me A Coffee

# srify

Adds computed `integrity` attributes to same domain external script and stylesheet tags on html markup.

## Install

```
npm install srify
```

## Usage

### CLI

```
srify build/index.html
srify --help
```

### Node.js

```javascript
const srify = require('srify')

const markup = `










`
const markupSrified = srify(markup, {
style: true, // default
script: true, // default
algorithm: 'sha384', // default
baseDir: 'build/assets' // default: ''
})
console.log(markupSrified)
```

output:
```html








```

## Test

```
npm test
```

## Change log

* `2.0.3`: fix `` regex
* `2.0.2`: properly handle `` tags inside ``
* ~~`2.0.1`: xxxxxxxx xxxxxx xxxx xxxxxx~~ *(removed)*
* `2.0.0`: add CLI command, change options defaults
* `1.0.1`: fix main entry in `package.json`
* `1.0.0`: initial release

## License

[MIT](LICENSE)