vite-plugin-simple-scope

v2.0.2
Get a scoped ID for whatever file you're in. Zero client-side JS.

simple scope 🔎

Get a scoped ID for whatever file you're in. Resolved at build-time with zero client JS.

import { scope } from 'simple:scope';

function Form() {
  return (
    <form>
      <label htmlFor={scope('email')}>Email</label>
      <input id={scope('email')} name="email" />
    </form>
  );
}

/*
Output:

<form>
  <label for="email-dj23i_ka">Email</label>
  <input id="email-dj23i_ka" name="email">
</form>
*/

📚 Visit the docs for more information and usage examples.

npm i vite-plugin-simple-scope

Metadata

  • MIT
  • >=18.14.1
  • bholmesdev
  • released 7/21/2024

Downloads

Maintainers