Gathering detailed insights and metrics for lit-css-loader
Gathering detailed insights and metrics for lit-css-loader
Gathering detailed insights and metrics for lit-css-loader
Gathering detailed insights and metrics for lit-css-loader
lit-scss-loader
Automatically generate the style-wrapper that is required for LitElement, simply by importing the CSS/SCSS file
esbuild-sass-plugin
esbuild plugin for sass/scss files supporting both css loader and css result import (lit-element)
@mordech/vite-lit-loader
A vite plugin for loading `svg`, `html`, `css`, `scss`, and `sass` files as `lit-html` templates/styles.
@bryanwood/lit-css-loader
npm install lit-css-loader
Typescript
Module System
Node Version
NPM Version
typescript-transform-lit-css@2.0.2
Updated on Mar 02, 2025
lit-css-loader@3.0.1
Updated on Jan 09, 2025
typescript-transform-lit-css@2.0.1
Updated on Jan 09, 2025
web-dev-server-plugin-lit-css@3.0.2
Updated on Jan 09, 2025
rollup-plugin-lit-css@5.0.2
Updated on Jan 09, 2025
esbuild-plugin-lit-css@3.0.2
Updated on Jan 09, 2025
JavaScript (51.67%)
TypeScript (47.59%)
CSS (0.53%)
SCSS (0.22%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
52 Stars
96 Commits
8 Forks
3 Watchers
6 Branches
6 Contributors
Updated on Jul 05, 2025
Latest Version
3.0.1
Package Id
lit-css-loader@3.0.1
Unpacked Size
6.66 kB
Size
2.56 kB
File Count
5
NPM Version
10.8.2
Node Version
18.20.5
Published on
Jan 09, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
Webpack loader to import css files as JavaScript tagged-template literal objects.
The "Lit" stands for "Literal"
You can use it to import CSS for various libraries like lit-element
,
@microsoft/fast-element
, or others.
No. This is an optional package who's sole purpose is to make it easier to write
CSS-in-CSS while working on lit-element projects. You can just as easily write
your CSS in some 'styles.css.js
' modules a la:
1import { css } from 'lit-element'; 2export default css`:host { display: block; }`;
And this may actually be preferred.
Hopefully this package will become quickly obsolete when the CSS Modules Proposal (or something like it) is accepted and implemented.
In the mean time, enjoy importing your CSS into your component files.
Name | Accepts | Default |
---|---|---|
include | Array of glob of files to include. | ['**/*.css'] |
exclude | Array of glob of files to exclude. | undefined |
cssnano | Boolean or Object of cssnano options. | false |
specifier | Package to import css from | lit |
tag | Name of the template-tag function | css |
transform | Optional function (sync or async) which transforms css sources (e.g. postcss) | x => x |
npm i -D lit-css-loader
1module: { 2 rules: [ 3 { 4 test: /\.css$/, 5 loader: 'lit-css-loader', 6 options: { 7 specifier: 'lit-element' // defaults to `lit` 8 } 9 } 10 ] 11}
1import { LitElement, html } from 'lit'; 2import { customElement } from 'lit/decorators.js'; 3 4import style from './styled-el.css'; 5 6@customElement('styled-el') 7export class extends LitElement { 8 static styles = [style] 9 render() { 10 return html`<p>such style. very win</p>`; 11 } 12}
To load scss files:
test
clause of the module rule as needed (e.g)transform
function to the loader options1const Sass = require('sass'); 2module.exports = { 3 module: { 4 rules: [ 5 { 6 test: /\.scss$/, 7 loader: 'lit-css-loader', 8 options: { 9 transform: (data, { filePath }) => 10 Sass.renderSync({ data, file: filePath }) 11 .css.toString(), 12 } 13 } 14 ] 15 } 16}
Similarly, to transform sources using PostCSS, specify a transform
function:
1const postcss = require('postcss'); 2const postcssNesting = require('postcss-nesting'); 3 4const processor = postcss(postcssNesting()); 5 6module.exports = { 7 module: { 8 rules: [ 9 { 10 test: /\.scss$/, 11 loader: 'lit-css-loader', 12 options: { 13 transform: (css, { filePath }) => 14 processor.process(css, { from: filePath }) 15 .css 16 } 17 } 18 ] 19 } 20}
Looking for rollup? rollup-plugin-lit-css Looking for esbuild? esbuild-plugin-lit-css Looking for typescript? typescript-transform-lit-css
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
Found 3/14 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
14 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More