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

CSS Import Assertions #6345

Closed
e111077 opened this issue Jun 23, 2022 · 2 comments
Closed

CSS Import Assertions #6345

e111077 opened this issue Jun 23, 2022 · 2 comments

Comments

@e111077
Copy link

e111077 commented Jun 23, 2022

CSS imports are soon to become a thing! it's already in Chrome!

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>
@Schweinepriester
Copy link
Contributor

Schweinepriester commented Jun 24, 2022

While I'm hyped as well, I believe your issue is a duplicate of #5944 - or is there a distinction?

If it is the same, I invite you to reply with your good content there, as the links aren't there yet and the example would make for a nice test on https://tests.caniuse.com/ :)

@e111077
Copy link
Author

e111077 commented Jun 24, 2022

It totally is! Nice catch. Couldn't find it because I kept searching for "assertions"

@e111077 e111077 closed this as completed Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants