
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
vite-plugin-lit-css
Advanced tools
Plugin to get all the power of Vite styles with lit tagged-template ⚡
Plugin to get all the power of Vite styles with lit tagged-template ⚡.
This plugin aims to get work with css lang stylesheet and lit template literals as simply as any other library or front-end framework.
$ npm install -D vite-plugin-lit-css
# yarn
$ npm install -D vite-plugin-lit-css
# pnpm
$ pnpm add -D vite-plugin-lit-css
Add vite-plugin-lit-css to your Vite config.
import { defineConfig } from 'vite'
import litCss from 'vite-plugin-lit-css'
export default defineConfig({
plugins: [litCss({
// your global and rel="stylesheet" styles must be excluded
exclude: './src/index.css'
})],
})
Then, import your stylesheets as any other javascript module in your code.
import { LitElement } from 'lit'
import styles from './styles.css'
export class Element extends LitElement {
static styles = [styles, queryStyles]
}
You can use types definitions inside your vite-env.d.ts. Remember: order is important!
/// <reference types="vite-plugin-lit-css/client" />
/// <reference types="vite/client" />
This plugin will transform all your css like styles by default into constructible library-specific css styles, but you can take control of this transformation with the include and exclude options.
import { defineConfig } from 'vite'
import litCss from 'vite-plugin-lit-css'
export default defineConfig({
plugins: [litCss({
include: /\.scss/, // transform only scss files as lit styles
exclude: [/global.css/, './src/index.css'] // exclude your global styles
})],
})
// index.ts
import './styles.global.css' // this file will skipped from this plugin
Your index.html will be transformed. You must include your theme or global css files inside exclude option!!.
Currently, HMR is not supported, and every change made inside your lit imported styles will trigger a full page reload.
For vite v4 use vite-plugin-lit-css 1.x
FAQs
Plugin to get all the power of Vite styles with lit tagged-template ⚡
The npm package vite-plugin-lit-css receives a total of 4,514 weekly downloads. As such, vite-plugin-lit-css popularity was classified as popular.
We found that vite-plugin-lit-css demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.