Skip to content

In place replacement for style-loader, that exports array of lit-element CSSResult

License

Notifications You must be signed in to change notification settings

CloudPSS/lit-style-loader

Repository files navigation

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

About

In place replacement for style-loader, that exports array of lit-element CSSResult

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published