From 3263c02d774a3fe8548a13037ab752c61c5d2f27 Mon Sep 17 00:00:00 2001 From: Drew Powers <1369770+drwpow@users.noreply.github.com> Date: Tue, 20 Apr 2021 15:06:33 -0600 Subject: [PATCH] Update Snowpack, Add CSS Modules SSR (#116) * Add CSS Modules SSR * Update docs --- README.md | 84 +++++++++++++++---- package-lock.json | 12 +-- package.json | 2 +- test/astro-styles-ssr.test.js | 13 ++- .../astro/components/ReactCSS.jsx | 2 +- .../astro/components/ReactModules.jsx | 11 +++ .../astro/components/ReactModules.module.css | 3 + .../astro/components/SvelteScoped.svelte | 2 +- .../astro/components/VueCSS.vue | 2 +- .../astro/components/VueModules.vue | 2 +- .../astro-styles-ssr/astro/pages/index.astro | 2 + 11 files changed, 103 insertions(+), 32 deletions(-) create mode 100644 test/fixtures/astro-styles-ssr/astro/components/ReactModules.jsx create mode 100644 test/fixtures/astro-styles-ssr/astro/components/ReactModules.module.css diff --git a/README.md b/README.md index af6bab0fa..415060afa 100644 --- a/README.md +++ b/README.md @@ -82,38 +82,81 @@ _Are we missing your favorite state management library? Add it to the list above ### ๐Ÿ’… Styling -If youโ€™ve used [Svelte][svelte]โ€™s styles before, Astro works almost the same way. In any `.astro` file, start writing styles in a ` -
Iโ€™m a scoped style
-``` + /* Scoped element selector within the component */ + h1 { + color: red; + } -#### ๐Ÿ‘“ Sass - -Astro also supports [Sass][sass] out-of-the-box; no configuration needed: - -```html - -

Title

+
Iโ€™m a scoped style and only apply to this component
+

I have both scoped and global styles

``` -Supports: +**Tips** -- `lang="scss"`: load as the `.scss` extension -- `lang="sass"`: load as the `.sass` extension (no brackets; indent-style) +- ` diff --git a/test/fixtures/astro-styles-ssr/astro/components/VueModules.vue b/test/fixtures/astro-styles-ssr/astro/components/VueModules.vue index 9bebf528b..bd520fec4 100644 --- a/test/fixtures/astro-styles-ssr/astro/components/VueModules.vue +++ b/test/fixtures/astro-styles-ssr/astro/components/VueModules.vue @@ -5,5 +5,5 @@ diff --git a/test/fixtures/astro-styles-ssr/astro/pages/index.astro b/test/fixtures/astro-styles-ssr/astro/pages/index.astro index ed788e217..45f9683ac 100644 --- a/test/fixtures/astro-styles-ssr/astro/pages/index.astro +++ b/test/fixtures/astro-styles-ssr/astro/pages/index.astro @@ -1,5 +1,6 @@ --- import ReactCSS from '../components/ReactCSS.jsx'; +import ReactModules from '../components/ReactModules.jsx'; import VueCSS from '../components/VueCSS.vue'; import VueScoped from '../components/VueScoped.vue'; import VueModules from '../components/VueModules.vue'; @@ -20,6 +21,7 @@ import SvelteScoped from '../components/SvelteScoped.svelte';
+