
Product
Socket Now Protects the Chrome Extension Ecosystem
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
rollup-plugin-postcss-lit
Advanced tools
A Rollup plugin to load postcss processed stylesheets in LitElement components
A Rollup plugin to load postcss processed stylesheets in LitElement components
$ npm i -D rollup-plugin-postcss-lit
Add the postcssLit
plugin after postcss
. This wraps postcss exported style strings with LitElement's css
template literal tag so you can import them directly in your components.
// rollup.config.js
import postcss from 'rollup-plugin-postcss';
import postcssLit from 'rollup-plugin-postcss-lit';
export default {
input: 'entry.js',
output: {
// ...
},
plugins: [
postcss({
// ...
}),
postcssLit(),
],
}
Enjoy postcss processed styles in your LitElement components!
import {customElement, LitElement, css} from 'lit-element';
import myStyles from './styles.css';
import otherStyles from './other-styles.scss';
@customElement('my-component')
export class MyComponent extends LitElement {
// Add a single style
static styles = myStyles;
// Or more!
static styles = [myStyles, otherStyles, css`
.foo {
padding: ${...};
}
`];
render() {
// ...
}
}
postcssLit({
// A glob (or array of globs) of files to include.
// By default this corresponds to the default extensions
// handled by postcss ('**/*.{css,sss,pcss}'). Make sure
// to set this if you want to load other extensions
// such as .scss, .less etc.
include: '**/*.{css,scss}',
// A glob (or array of globs) of files to exclude.
// Default: undefined
exclude,
}),
This plugin is meant to be used with rollup-plugin-postcss
.
If you only need to load plain css files in your LitElement components,
consider using rollup-plugin-lit-css
.
This project is licensed under the MIT License, see LICENSE file for details.
FAQs
Rollup plugin to load PostCSSed stylesheets in LitElement components
The npm package rollup-plugin-postcss-lit receives a total of 10,007 weekly downloads. As such, rollup-plugin-postcss-lit popularity was classified as popular.
We found that rollup-plugin-postcss-lit 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.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.