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

Add CSS module script/CSS modules #5944

Open
Schweinepriester opened this issue Jun 12, 2021 · 2 comments
Open

Add CSS module script/CSS modules #5944

Schweinepriester opened this issue Jun 12, 2021 · 2 comments

Comments

@atjn
Copy link
Contributor

atjn commented Jun 16, 2021

Related: #5928

@e111077
Copy link

e111077 commented Jun 24, 2022

I accidentally made a duplicate issue but here's more relevant info:

Stage 3: https://github.com/tc39/proposal-import-assertions
web.dev explainer: https://web.dev/css-module-scripts/

// styles.css
div {
  color: red;
}
// index.js
import styles from './styles.css' assert { type: "css" };
document.adoptedStyleSheets = [styles];
const success = getComputedStyle(document.querySelector('div')).color === 'rgb(255, 0, 0)'
// index.html
<script type="module" src="./index.js"></script>
<div>YOLO</div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants