Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpler CSS import for TS views and CSS @import support #8843

Merged
merged 1 commit into from
Aug 12, 2020

Commits on Aug 12, 2020

  1. Simpler CSS import for TS views and CSS @import support

    This modifies the default webpack loader configuration for all *.css files. Instead of the previous `raw-loader` only, this will use a loader chain of `['lit-css-loader', 'extract-loader', 'css-loader']`.
    
    `lit-css-loader` gives us a nice DX of importing styles to TS views like this:
    ```ts
    import styles from './list-view.css';
    
    @CustomElement('list-view')
    export class ListView extends LitElement {
      static styles = [Lumo, styles];
    ```
    
    `css-loader` gives the additional benefit of resolving CSS `@import "file.css";` syntax in CSS files. This is a new features that works both for TS views and also when using `@CssImport()` annotation in Java.
    
    `extract-loader` is needed in the middle to convert the JS output of `css-loader` into a plain CSS string.
    Haprog committed Aug 12, 2020
    Configuration menu
    Copy the full SHA
    f837ed2 View commit details
    Browse the repository at this point in the history