Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elhebert/laravel-mix-sri
A laravel mix extension to generate integrity hashes on build for your assets.
https://github.com/elhebert/laravel-mix-sri
hacktoberfest laravel-mix laravel-mix-plugin subresource-integrity
Last synced: 5 days ago
JSON representation
A laravel mix extension to generate integrity hashes on build for your assets.
- Host: GitHub
- URL: https://github.com/elhebert/laravel-mix-sri
- Owner: Elhebert
- License: mit
- Created: 2018-03-16T11:23:09.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-31T04:47:18.000Z (4 months ago)
- Last Synced: 2024-12-08T23:12:19.280Z (14 days ago)
- Topics: hacktoberfest, laravel-mix, laravel-mix-plugin, subresource-integrity
- Language: TypeScript
- Homepage:
- Size: 1.82 MB
- Stars: 22
- Watchers: 3
- Forks: 13
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Mix Subresource Integrity
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
A laravel mix 6.0 extension to generate integrity hashes on build for your assets.
For older version of mix, see [v0.0.7](https://github.com/Elhebert/laravel-mix-sri/tree/0.0.7)
## Installation
```bash
$ npm install laravel-mix-sri
```## Config
You can pass an object to the function. Available keys are:
- `enabled`: boolean, default: `mix.Inproduction()`
- `algorithm`: string, default: `'sha256'`## Usage
```js
let mix = require('laravel-mix')
require('laravel-mix-sri')mix.sass('src/app.sass', 'dist')
.js('src/app.js', 'dist')
.generateIntegrityHash()
```At every build it'll generate (or update the content of) a `mix-sri.json` file. The file is located within the `public` directory with the `mix-manifest.json`.
You can use [laravel-sri](https://github.com/Elhebert/laravel-sri) package to parse the `mix-sri.json` file and generate according attributes for your assets.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for more details.
## License
This project and The Laravel framework are open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).