Skip to content

Use file hashes in query strings instead of file name

License

Notifications You must be signed in to change notification settings

Media24si/vite-plugin-query-string-versioning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

vite-plugin-query-string-versioning

Install

npm i vite-plugin-query-string-versioning

Usage

import queryStringVersioning from 'vite-plugin-query-string-versioning';

export default {
  plugins: [
    queryStringVersioning()
  ]
};

Using in Laravel

When utilizing this plugin in Laravel, it's necessary to override the default Vite class to ensure proper detection of CSS files.

Laravel >=11

In bootstrap/app.php register singleton:

->withSingletons([
    Vite::class => fn() => new class extends Vite {
        protected function isCssPath($path): bool
        {
            return Str::contains($path, '.css');
        }
    }
])

Laravel <=10

In AppServiceProvider.php add the following to the register method:

$this->app->singleton(
    Vite::class,
    fn() => new class extends Vite {
        protected function isCssPath($path) {
            return Str::contains($path, '.css');
        }
    }
);

About

Use file hashes in query strings instead of file name

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published