Make use css module more sense.

Overview

vite-plugin-sense-css-module

Make use css module more sense.

Installation

npm

npm install --save-dev vite-plugin-sense-css-module

yarn

yarn add -D vite-plugin-sense-css-module

Usage

import { defineConfig } from 'vite';
import senseCssModule from 'vite-plugin-sense-css-module';

export default defineConfig({
  css: {
    modules: {
      localsConvention: 'camelCaseOnly',
      generateScopedName: (name, filename) => {
        const res = `SUIS_${basename(filename).replace(/\.module\.scss(.*)$/, '')}_${name}`;
        return res;
      },
    },
  },
  plugins: [
    ...
    senseCssModule({ classAttributeRegex: /(class(Name|List)?|activeClass)/ }),
    ...
  ],
  build: {
    target: 'esnext',
  },
}

Options:

Default classAttributeRegex: /class(Name|List)?/

  senseCssModule({ classAttributeRegex?: RegExp }),

What does it do?

Normal when using css module.

import { Link, Outlet } from 'solidjs-sense-router';
import { t } from '../util';
import styles from './usage.module.scss';

export default () => {
  return (
    <>
      <div class={styles.title}>{t('usage-example')}</div>
      <div class={styles.ctn}>
        <div class={styles.nav}>
          <Link href="/usage/dialog" class={styles.item} activeClass={styles.active}>
            <span>Dialog</span>
          </Link>
          <Link href="/usage/color-picker" class={styles.item} activeClass={styles.active}>
            <span>Color Picker</span>
          </Link>
        </div>
        <div class={styles.content}>
          <Outlet />
        </div>
      </div>
    </>
  );
};

When using this plugin.

import { Link, Outlet } from 'solidjs-sense-router';
import { t } from '../util';
import './usage.module.scss';

export default () => {
  return (
    <>
      <div class="title">{t('usage-example')}</div>
      <div class="ctn">
        <div class="nav">
          <Link href="/usage/dialog" class="item" activeClass="active">
            <span>Dialog</span>
          </Link>
          <Link href="/usage/color-picker" class="item" activeClass="active">
            <span>Color Picker</span>
          </Link>
        </div>
        <div class="content">
          <Outlet />
        </div>
      </div>
    </>
  );
};

It will translate to

import { Link, Outlet } from 'solidjs-sense-router';
import { t } from '../util';
import './usage.module.scss';

export default () => {
  return (
    <>
      <div class="SUIS_usage_title">{t('usage-example')}</div>
      <div class="SUIS_usage_ctn">
        <div class="SUIS_usage_nav">
          <Link href="/usage/dialog" class="SUIS_usage_item" activeClass="SUIS_usage_active">
            <span>Dialog</span>
          </Link>
          <Link href="/usage/color-picker" class="SUIS_usage_item" activeClass="SUIS_usage_active">
            <span>Color Picker</span>
          </Link>
        </div>
        <div class="SUIS_usage_content">
          <Outlet />
        </div>
      </div>
    </>
  );
};
You might also like...

Restream is a module that allows you to create a stream of an audio/video file from the Firebase storage, protected from direct download through the client-side.

nuxt-restream Restream is a module that allows you to create a stream of an audio/video file from the Firebase storage, protected from direct download

Dec 13, 2022

Nuxt 3 module for Web3.js

nuxt-web3.js Nuxt 3 module for Web3.js. Installation npm install nuxt-web3.js Usage export default defineNuxtConfig({ modules: ['nuxt-web3.js'], })

Dec 16, 2022

OpenID-Connect(OIDC) integration module for nuxt 3.0.

Nuxt OpenID-Connect OpenID-Connect(OIDC) integration module for nuxt 3.0. Features An Nuxt 3 module. OIDC integration ( implemetation base openid-clie

Dec 24, 2022

🔎 Meilisearch module for Nuxt 3

🔎 Meilisearch module for Nuxt 3

nuxt-meilisearch Meilisearch module for Nuxt Features Nuxt 3 Easy integration with MeilisearchJS lib Support for Vue Algolia Vue 3 InstantSearch compo

Dec 26, 2022

✉️ Nuxt module for first class integration with popular newsletter providers

✉️ Nuxt module for first class integration with popular newsletter providers

nuxt-newsletter Newsletter module for Nuxt 3 ✨ Release Notes 📖 Read the documentation Features Nuxt 3 ready Easy integration with Mailchimp, Revue, B

Jan 5, 2023

🔎 Algolia module for Nuxt

🔎 Algolia module for Nuxt

@nuxtjs/algolia Algolia module for Nuxt ✨ Release Notes 📖 Read the documentation Features Nuxt 3 ready Easy integration with Algolia Handy composable

Jul 28, 2022

A Nuxt.js module that injects a server route to serve the GraphQL Playground

@pin-pon/nuxt-graphql-playground A Nuxt.js module that injects a server route to serve the GraphQL Playground Setup Add @pin-pon/nuxt-graphql-playgrou

Sep 22, 2022

🪅 Nuxt 3 module to connect with any API securely – server proxy & customizable composable names

nuxt-api-party This module provides composables to fetch data from an API of your choice securely. You can customize the composable names! Given json-

Dec 26, 2022

Make your Vite projects work in IE11 and other legacy browsers.

vite-plugin-legacy-dev Maybe your Vite project needs work on IE11 or other not support ESM legacy browsers, this plugin can help you! This is only for

Sep 26, 2022
Owner
Make solidjs sense
null
Nuxt-Module, that provides a system to set shopware cache-tags for later use in e.g. a full-page cache

nuxt-shopware-caching Nuxt-Module, that provides a system to set shopware cache-tags for later use in e.g. a full-page cache. This module is meant to

Mothership GmbH 5 Nov 8, 2022
A template to use GoLang Lorca package to make desktop applications using webview and Svelte for the frontend,

Svelte Lorca Template A starter project for building modern cross-platform desktop apps in Go, HTML, and Svelte. This project is a fork of lorca-ts-re

Ben Winchester 16 Jun 19, 2022
Make pinia easy to use and has intelisense.

pinia-auto-refs Pinia Auto Refs on-demand for Vite. With TypeScript support. Powered by unplugin-auto-import.Inspiration by vieruuuu in pinia/issues#7

allen 6 Dec 26, 2022
Collection of CSS box-shadows for every taste contains more than 100 simple, beautiful and airy shadows.

Vue Box-shadows Collection of CSS box-shadows for every taste contains more than 100 simple, beautiful and airy shadows. Add beautiful shadow effects

Andrej Sharapov 29 Nov 14, 2022
Matteo Bruni 4.7k Jan 4, 2023
The first truly composable CSS animation library. Built for Vue, React, SCSS, and CSS, AnimXYZ will bring your website to life.

AnimXYZ animxyz.com AnimXYZ helps you create, customize, and compose animations for your website. Powered by CSS variables to allow a nearly limitless

Ingram Projects 2.1k Jan 2, 2023
NuxtJS module for Stripe.js

@chantouchsek/nuxt-stripe NuxtJS module for Stripe.js Table of contents Features Setup Options Usage License Features Load Stripe.js only when require

Chantouch Sek 2 Oct 9, 2021
Vite-plugin-web-extension - A vite plugin for generating cross browser platform, ES module based web extensions.

vite-plugin-web-extension A vite plugin for generating cross browser platform, ES module based web extensions. Features Manifest V2 & V3 Support Compl

Ruben Medina 81 Dec 31, 2022
🔎 Algolia module for Nuxt

@nuxtjs/algolia Algolia module for Nuxt ✨ Release Notes ?? Read the documentation Features Nuxt 3 ready Easy integration with Algolia Handy composable

Nuxt Community 128 Jan 7, 2023
Nuxt 3 module for Kirby's Query Language API

nuxt-kql Kirby KQL module for Nuxt 3. This module provides a useKql composable, which under the hood uses useFetch. Thus, KQL query fetching in your N

Johann Schopplich 25 Dec 15, 2022