1.0.7 • Published 10 months ago

@jswork/vite-public-resource-hash v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

vite-public-resource-hash

This Vite plugin replaces content_hash in public resources with actual hashes.

version license size download

installation

npm install @jswork/vite-public-resource-hash

usage

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import vitePubliResourceHash from '@jswork/vite-public-resource-hash';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react(), vitePubliResourceHash()],
  server: {
    host: '0.0.0.0'
  }
});

src/app.tsx

<figure>
  <img src="/vite.svg?hash=__content_hash__" alt="Vite Logo" className="logo" />
  <figcaption>Image from public directory</figcaption>
</figure>

dist/assets/vite.svg?hash=`content_hash

<figure>
  <img src="/vite.svg?hash=8e3a10e1" alt="Vite Logo" class="logo">
  <figcaption>Image from public directory</figcaption>
</figure>

license

Code released under the MIT license.

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago