Skip to content

Latest commit

 

History

History
74 lines (57 loc) · 1.21 KB

README.md

File metadata and controls

74 lines (57 loc) · 1.21 KB

Lit Style Loader

lit-style-loader

Exports CSS as CSSResult[] for lit-element.

Getting Started

To begin, you'll need to install lit-style-loader:

npm install --save-dev lit-style-loader
yarn add --dev lit-style-loader

It's recommended to combine lit-style-loader with the css-loader

Then add the loader to your webpack config. For example:

component.css

:host {
  background: green;
}

component.js

import styles from "./style.css?lit";

export default class extends LitElement {
  static get styles() {
    return styles;
  }
}

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/i,
        oneOf: [
          {
            resourceQuery: /lit/,
            use: ["lit-style-loader", "css-loader"],
          },
          {
            use: ["style-loader", "css-loader"],
          },
        ],
      },
    ],
  },
};

License

MIT