Skip to content

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

License

Notifications You must be signed in to change notification settings

Elhebert/laravel-mix-sri

This branch is up to date with master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

76af902 · May 11, 2024

History

73 Commits
Nov 11, 2021
Mar 16, 2018
Oct 26, 2021
Mar 16, 2018
Mar 16, 2018
Mar 16, 2018
Apr 29, 2021
May 11, 2024
Nov 11, 2021
Apr 29, 2021

Repository files navigation

Laravel Mix Subresource Integrity

Software License

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

For older version of mix, see v0.0.7

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.