Re: [w3c/webcomponents] CSS Modules (#759)

> We already have a standardized compile target: HTML and CSS, with no client-side JS required.

@dfabulich If we want to `import` CSS, then no, we can't compile to CSS. The CSS has to either be wrapped in a Javascript file via e.g. default export, or use `fetch` to retrieve CSS text content.

```js
// style.css
export default `
  body { /* style */ }
`;
// or
const style = await (await fetch('/style.css')).text();
```

After this, a `style` tag or Constructible StyleSheet must be created and the text inserted. This is quite a bit of extra code for a trivial example over simply using `import style from '/style.css'` and getting back something that is directly usable.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/759#issuecomment-520986112

Received on Tuesday, 13 August 2019 20:00:48 UTC