Skip to content

Commit 46b51eb

Browse files
authored
Update styling.md
Updates syntax to replace deprecated import assertion syntax to new import atttributes`with` syntax
1 parent a093458 commit 46b51eb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

learn/components/styling.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ class FancyArticleElement extends HTMLElement {
292292
### Using CSS Module scripts
293293

294294
CSS Module scripts allow developers to import stylesheets as if they were a module script. To do so, use an import
295-
assertion where the `type` is `css` and then you can add the imported stylesheet to the `adoptedStyleSheets` array for
295+
attribute where the `type` is `css` and then you can add the imported stylesheet to the `adoptedStyleSheets` array for
296296
the element's shadow root.
297297

298298
```js
299-
import stylesheet from "./fancy-article-element.css" assert { type: "css" }
299+
import stylesheet from "./fancy-article-element.css" with { type: "css" }
300300

301301
class FancyArticleElement extends HTMLElement {
302302
connectedCallback() {
@@ -305,4 +305,10 @@ class FancyArticleElement extends HTMLElement {
305305
}
306306
```
307307

308+
Note that import assertion (the old name for import attributes) has been deprecated. The following will not work in :
309+
310+
```js
311+
import stylesheet from "./fancy-article-element.css" assert { type: "css" }
312+
```
313+
308314
[css-custom-properties]: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties

0 commit comments

Comments
 (0)