You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: remove unscopable global warning
* remove FAQ entry
* Apply suggestion from @teemingc
---------
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Copy file name to clipboardExpand all lines: docs/faq.md
-28Lines changed: 0 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,34 +54,6 @@ Bad:
54
54
<scripttype="text/typescript"></script>
55
55
```
56
56
57
-
### Where should I put my global styles?
58
-
59
-
Global styles should always be placed in their own stylesheet files whenever possible, and not in a Svelte component's `<style>` tag. The stylesheet files can then be imported directly in JS and take advantage of Vite's own style processing. It would also significantly improve the dev server startup time.
60
-
61
-
Good:
62
-
63
-
```scss
64
-
/* global.scss */
65
-
html {
66
-
color: $text-color;
67
-
}
68
-
```
69
-
70
-
```js
71
-
// main.js
72
-
import'./global.scss';
73
-
```
74
-
75
-
Bad:
76
-
77
-
```svelte
78
-
<style lang="scss">
79
-
:global(html) {
80
-
color: $text-color;
81
-
}
82
-
</style>
83
-
```
84
-
85
57
### Why can't `cssHash` be set in development mode?
86
58
87
59
`cssHash` is fixed in development for CSS HMR in Svelte components, ensuring that the hash value is stable based on the file name so that styles are only updated when changed.
"No scopable elements found in template. If you're using global styles in the style tag, you should move it into an external stylesheet file and import it in JS. See https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#where-should-i-put-my-global-styles."
0 commit comments