Exports CSS as CSSResult[]
for lit-element
.
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"],
},
],
},
],
},
};