A laravel mix extension to generate integrity hashes on build for your assets.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 1 commit ahead, 1 commit behind Elhebert:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.editorconfig
.gitignore
.prettierrc
CONTRIBUTING.md
LICENSE.md
README.md
package-lock.json
package.json

README.md

Laravel Mix Subresource Integrity

Software License

A laravel mix extension to generate integrity hashes on build for your assets.

Installation

$ 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

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 package to parse the mix-sri.json file and generate according attributes for your assets.

Contributing

Please see CONTRIBUTING for more details.

License

This project and The Laravel framework are open-sourced software licensed under the MIT license.