Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Add support for shared CSS #29

Open
thescientist13 opened this issue May 30, 2018 · 3 comments
Open

Add support for shared CSS #29

thescientist13 opened this issue May 30, 2018 · 3 comments
Labels
documentation Documentation for the wiki enhancement New feature or request example something that should include a code sample question Further information is requested
Milestone

Comments

@thescientist13
Copy link
Member

One really nice feature of tools like LESS and Sass is being able to @import other LESS / SASS files and more importantly, be able to share variables through them. Often there would be a "main" CSS file that all the other components could import and reuse.

Documenting a pattern for this should be a top priority.

@thescientist13 thescientist13 added enhancement New feature or request question Further information is requested documentation Documentation for the wiki labels May 30, 2018
@thescientist13 thescientist13 added this to the Alpha milestone May 30, 2018
@thescientist13 thescientist13 added the example something that should include a code sample label May 30, 2018
@thescientist13
Copy link
Member Author

thescientist13 commented May 31, 2018

I suppose it as easy as just @import ing the CSS from another component adding it to the component's style tag

import { html } from 'lit-html';
import css from './component.css';
import sharedCss from '../app/app.css';

class MyComponent extends HTMLElement {
  /* code /*

  render() {
    return html`
      <styles>
       ${sharedCss}
       ${css}
      </styles>
    `
  }
}

Maybe this has overlaps with CSS Production / native bundling, to help ensure a lot of duplicate styles aren't generated / bundled.

@thescientist13
Copy link
Member Author

Wonder if CSS modules could help here?
https://twitter.com/justinfagnani/status/1121126623124705280

cc: @hutchgrant

@thescientist13
Copy link
Member Author

also, not sure if this doc is of any help
https://blog.webf.zone/on-styling-web-components-b74b8c70c492

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Documentation for the wiki enhancement New feature or request example something that should include a code sample question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant