1.0.13 • Published 1 year ago

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

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year 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.9

1 year ago

1.0.8

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago