Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

vite-plugin-libcss

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-libcss

This plugin will inject css into bundled js file using `import` statement.

latest
Source
npmnpm
Version
1.1.2
Version published
Weekly downloads
20K
16.73%
Maintainers
1
Weekly downloads
 
Created
Source

vite-plugin-libcss

This plugin will inject css into bundled js file using import statement like this:

// bundled js file, with import css at top (if any)
import './style.css';
// rest of the file
// ...

Install:

npm i vite-plugin-libcss -D

Usage:

// vite.config.js
import libCss from 'vite-plugin-libcss';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    // any other plugins
    libCss()
  ],
});

or with include/exclude options

// vite.config.js
import libCss from 'vite-plugin-libcss';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    // any other plugins
    libCss({
      include: 'src/**/*', // Include all entry files
      exclude: 'src/utils/*', // Exclude entry files in the "utils" directory
    })
  ],
});

Note that this plugin will only work with library-mode and es format build.

Keywords

vite

FAQs

Package last updated on 03 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts