Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 months ago
JSON representation
Adds computed integrity attributes to same domain external script and stylesheet tags on html markup
- Host: GitHub
- URL: https://github.com/layflags/srify
- Owner: layflags
- License: mit
- Created: 2018-08-30T20:41:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-07-10T15:07:38.000Z (5 months ago)
- Last Synced: 2024-10-12T16:51:28.964Z (2 months ago)
- Topics: cli, html, markup, nodejs, npm, script, sri, style, subresource-integrity
- Language: JavaScript
- Homepage:
- Size: 238 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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)