Skip to content

Easy subresource integrity and versioning for local assets - Laravel Plugin

License

Notifications You must be signed in to change notification settings

gaigelama/Vasri

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Stable Version Total Downloads Latest Unstable Version Build Status Scrutinizer Code Quality License

Vasri

Easy subresource integrity and versioning for local assets

This is also meant to replace the Laravel Mix helper.

Install

composer require exounx/vasri

Publish the config

php artisan vendor:publish --provider="ExoUNX\Vasri\Providers\VasriServiceProvider"

Usage

Note: If you use a CDN like Cloudflare that processes your assets at their edge servers, I recommend you disable it and process your scripts beforehand otherwise assets may not load

You'll need to generate the manifest first and every time the assets change

php artisan vasri:build

For CSS

<link rel="stylesheet" {!! vasri('/css/app.css') !!}/>

For JS

<script {!! vasri('/js/app.js') !!}></script>

By default Vasri is configured to read the mix-manifest.json in your public Laravel directory.

If you don't wish to use the mix manifest you can disable it in the config

'mix-manifest' => false,

You'll need to specify your assets manually in the config if you disable mix-manifest support

'assets' => [
    '/css/app.css',
    '/js/app.js',
]

License

The MIT License (MIT). Please see License File for more information.