You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

rollup-plugin-postcss-lit

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

rollup-plugin-postcss-lit

A Rollup plugin to load postcss processed stylesheets in LitElement components

0.2.0
Source
npmnpm
Version published
Weekly downloads
12K
22.61%
Maintainers
1
Weekly downloads
 
Created
Source

Rollup plugin postcss lit

A Rollup plugin to load postcss processed stylesheets in LitElement components

Install

$ npm i -D rollup-plugin-postcss-lit

Usage

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() {
      // ...
  }
}

Options

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,
}),

When should I use it?

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.

License

This project is licensed under the MIT License, see LICENSE file for details.

Keywords

postcss

FAQs

Package last updated on 16 May 2019

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