diff --git a/.changeset/cool-knives-fry.md b/.changeset/cool-knives-fry.md
new file mode 100644
index 000000000..737ce7b41
--- /dev/null
+++ b/.changeset/cool-knives-fry.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Bump Sass dependency version
diff --git a/packages/astro/package.json b/packages/astro/package.json
index a88a30210..4d8332b31 100644
--- a/packages/astro/package.json
+++ b/packages/astro/package.json
@@ -90,7 +90,7 @@
"rehype-slug": "^5.0.0",
"resolve": "^1.20.0",
"rollup": "^2.57.0",
- "sass": "^1.43.3",
+ "sass": "^1.43.4",
"semver": "^7.3.5",
"send": "^0.17.1",
"shiki": "^0.9.10",
diff --git a/packages/astro/test/0-css.test.js b/packages/astro/test/0-css.test.js
new file mode 100644
index 000000000..734e16445
--- /dev/null
+++ b/packages/astro/test/0-css.test.js
@@ -0,0 +1,269 @@
+/**
+ * CSS test
+ * Run this test first! This uses quite a bit of memory, so prefixing with `0-` helps it start and finish early,
+ * rather than trying to start up when all other threads are busy and having to fight for resources
+ */
+
+import { expect } from 'chai';
+import cheerio from 'cheerio';
+import { loadFixture } from './test-utils.js';
+
+describe('Styles SSR', function () {
+ this.timeout(30000); // test needs a little more time in CI
+
+ let fixture;
+ let index$;
+ let bundledCSS;
+
+ before(async () => {
+ fixture = await loadFixture({
+ projectRoot: './fixtures/0-css/',
+ renderers: ['@astrojs/renderer-react', '@astrojs/renderer-svelte', '@astrojs/renderer-vue'],
+ });
+ await fixture.build();
+
+ // get bundled CSS (will be hashed, hence DOM query)
+ const html = await fixture.readFile('/index.html');
+ index$ = cheerio.load(html);
+ const bundledCSSHREF = index$('link[rel=stylesheet][href^=assets/]').attr('href');
+ bundledCSS = await fixture.readFile(bundledCSSHREF.replace(/^\/?/, '/'));
+ });
+
+ describe('Astro styles', () => {
+ it('HTML and CSS scoped correctly', async () => {
+ const $ = index$;
+
+ const el1 = $('#dynamic-class');
+ const el2 = $('#dynamic-vis');
+ const classes = $('#class').attr('class').split(' ');
+ const scopedClass = classes.find((name) => /^astro-[A-Za-z0-9-]+/.test(name));
+
+ // 1. check HTML
+ expect(el1.attr('class')).to.equal(`blue ${scopedClass}`);
+ expect(el2.attr('class')).to.equal(`visible ${scopedClass}`);
+
+ // 2. check CSS
+ expect(bundledCSS).to.include(`.blue.${scopedClass}{color:#b0e0e6}.color\\:blue.${scopedClass}{color:#b0e0e6}.visible.${scopedClass}{display:block}`);
+ });
+
+ it('No
+
+
Color
diff --git a/packages/astro/test/fixtures/0-css/src/components/AstroScss.astro b/packages/astro/test/fixtures/0-css/src/components/AstroScss.astro
new file mode 100644
index 000000000..f7ddd71d7
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/AstroScss.astro
@@ -0,0 +1,9 @@
+
+
+Color
diff --git a/packages/astro/test/fixtures/astro-styles-ssr/src/components/ReactCSS.css b/packages/astro/test/fixtures/0-css/src/components/ReactCSS.css
similarity index 100%
rename from packages/astro/test/fixtures/astro-styles-ssr/src/components/ReactCSS.css
rename to packages/astro/test/fixtures/0-css/src/components/ReactCSS.css
diff --git a/packages/astro/test/fixtures/astro-styles-ssr/src/components/ReactCSS.jsx b/packages/astro/test/fixtures/0-css/src/components/ReactCSS.jsx
similarity index 100%
rename from packages/astro/test/fixtures/astro-styles-ssr/src/components/ReactCSS.jsx
rename to packages/astro/test/fixtures/0-css/src/components/ReactCSS.jsx
diff --git a/packages/astro/test/fixtures/astro-styles-ssr/src/components/ReactDynamic.jsx b/packages/astro/test/fixtures/0-css/src/components/ReactDynamic.jsx
similarity index 100%
rename from packages/astro/test/fixtures/astro-styles-ssr/src/components/ReactDynamic.jsx
rename to packages/astro/test/fixtures/0-css/src/components/ReactDynamic.jsx
diff --git a/packages/astro/test/fixtures/astro-styles-ssr/src/components/ReactModules.jsx b/packages/astro/test/fixtures/0-css/src/components/ReactModules.jsx
similarity index 76%
rename from packages/astro/test/fixtures/astro-styles-ssr/src/components/ReactModules.jsx
rename to packages/astro/test/fixtures/0-css/src/components/ReactModules.jsx
index b3aef6bb2..1d13dc2c4 100644
--- a/packages/astro/test/fixtures/astro-styles-ssr/src/components/ReactModules.jsx
+++ b/packages/astro/test/fixtures/0-css/src/components/ReactModules.jsx
@@ -3,7 +3,7 @@ import Styles from './ReactModules.module.css';
function ReactModules() {
return (
-
+
React Modules
);
diff --git a/packages/astro/test/fixtures/astro-styles-ssr/src/components/ReactModules.module.css b/packages/astro/test/fixtures/0-css/src/components/ReactModules.module.css
similarity index 100%
rename from packages/astro/test/fixtures/astro-styles-ssr/src/components/ReactModules.module.css
rename to packages/astro/test/fixtures/0-css/src/components/ReactModules.module.css
diff --git a/packages/astro/test/fixtures/0-css/src/components/ReactModules.module.sass b/packages/astro/test/fixtures/0-css/src/components/ReactModules.module.sass
new file mode 100644
index 000000000..921ff903a
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/ReactModules.module.sass
@@ -0,0 +1,4 @@
+$font-family: fantasy
+
+.title
+ font-family: $font-family
diff --git a/packages/astro/test/fixtures/0-css/src/components/ReactModules.module.scss b/packages/astro/test/fixtures/0-css/src/components/ReactModules.module.scss
new file mode 100644
index 000000000..03c6d1090
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/ReactModules.module.scss
@@ -0,0 +1,5 @@
+$font-family: fantasy;
+
+.title {
+ font-family: $font-family;
+}
diff --git a/packages/astro/test/fixtures/0-css/src/components/ReactModulesSass.jsx b/packages/astro/test/fixtures/0-css/src/components/ReactModulesSass.jsx
new file mode 100644
index 000000000..bd5436168
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/ReactModulesSass.jsx
@@ -0,0 +1,11 @@
+import React from 'react';
+import Styles from './ReactModules.module.sass';
+
+function ReactModules() {
+ return (
+
+ React Modules
+
+ );
+}
+export default ReactModules;
diff --git a/packages/astro/test/fixtures/0-css/src/components/ReactModulesScss.jsx b/packages/astro/test/fixtures/0-css/src/components/ReactModulesScss.jsx
new file mode 100644
index 000000000..8965e349d
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/ReactModulesScss.jsx
@@ -0,0 +1,11 @@
+import React from 'react';
+import Styles from './ReactModules.module.scss';
+
+function ReactModules() {
+ return (
+
+ React Modules
+
+ );
+}
+export default ReactModules;
diff --git a/packages/astro/test/fixtures/0-css/src/components/ReactSass.jsx b/packages/astro/test/fixtures/0-css/src/components/ReactSass.jsx
new file mode 100644
index 000000000..79e2383f2
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/ReactSass.jsx
@@ -0,0 +1,11 @@
+import React from 'react';
+import './ReactSass.sass';
+
+function ReactCSS() {
+ return (
+
+ React Global Sass
+
+ );
+}
+export default ReactCSS;
diff --git a/packages/astro/test/fixtures/0-css/src/components/ReactSass.sass b/packages/astro/test/fixtures/0-css/src/components/ReactSass.sass
new file mode 100644
index 000000000..0ba8bd115
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/ReactSass.sass
@@ -0,0 +1,5 @@
+$font-family: fantasy
+
+.react-sass-title
+ font-family: $font-family
+
diff --git a/packages/astro/test/fixtures/0-css/src/components/ReactScss.jsx b/packages/astro/test/fixtures/0-css/src/components/ReactScss.jsx
new file mode 100644
index 000000000..cff5763e2
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/ReactScss.jsx
@@ -0,0 +1,11 @@
+import React from 'react';
+import './ReactScss.scss';
+
+function ReactCSS() {
+ return (
+
+ React Global Scss
+
+ );
+}
+export default ReactCSS;
diff --git a/packages/astro/test/fixtures/0-css/src/components/ReactScss.scss b/packages/astro/test/fixtures/0-css/src/components/ReactScss.scss
new file mode 100644
index 000000000..0b3762956
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/ReactScss.scss
@@ -0,0 +1,6 @@
+$font-family: fantasy;
+
+.react-scss-title {
+ font-family: $font-family;
+}
+
diff --git a/packages/astro/test/fixtures/0-css/src/components/SvelteCSS.svelte b/packages/astro/test/fixtures/0-css/src/components/SvelteCSS.svelte
new file mode 100644
index 000000000..b02001758
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/SvelteCSS.svelte
@@ -0,0 +1,7 @@
+Svelte Scoped CSS
+
+
diff --git a/packages/astro/test/fixtures/0-css/src/components/SvelteSass.svelte b/packages/astro/test/fixtures/0-css/src/components/SvelteSass.svelte
new file mode 100644
index 000000000..35249e69b
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/SvelteSass.svelte
@@ -0,0 +1,8 @@
+Svelte Scoped Sass
+
+
diff --git a/packages/astro/test/fixtures/0-css/src/components/SvelteScss.svelte b/packages/astro/test/fixtures/0-css/src/components/SvelteScss.svelte
new file mode 100644
index 000000000..ac2145d58
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/SvelteScss.svelte
@@ -0,0 +1,9 @@
+Svelte Scoped Scss
+
+
diff --git a/packages/astro/test/fixtures/0-css/src/components/VueCSS.vue b/packages/astro/test/fixtures/0-css/src/components/VueCSS.vue
new file mode 100644
index 000000000..ded98858f
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/VueCSS.vue
@@ -0,0 +1,9 @@
+
+
+
+ Vue Global CSS
+
diff --git a/packages/astro/test/fixtures/astro-styles-ssr/src/components/VueModules.vue b/packages/astro/test/fixtures/0-css/src/components/VueModules.vue
similarity index 100%
rename from packages/astro/test/fixtures/astro-styles-ssr/src/components/VueModules.vue
rename to packages/astro/test/fixtures/0-css/src/components/VueModules.vue
diff --git a/packages/astro/test/fixtures/0-css/src/components/VueSass.vue b/packages/astro/test/fixtures/0-css/src/components/VueSass.vue
new file mode 100644
index 000000000..a4cac8008
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/VueSass.vue
@@ -0,0 +1,10 @@
+
+
+
+ Vue Sass
+
diff --git a/packages/astro/test/fixtures/astro-styles-ssr/src/components/VueScoped.vue b/packages/astro/test/fixtures/0-css/src/components/VueScoped.vue
similarity index 100%
rename from packages/astro/test/fixtures/astro-styles-ssr/src/components/VueScoped.vue
rename to packages/astro/test/fixtures/0-css/src/components/VueScoped.vue
diff --git a/packages/astro/test/fixtures/0-css/src/components/VueScss.vue b/packages/astro/test/fixtures/0-css/src/components/VueScss.vue
new file mode 100644
index 000000000..83395d4f3
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/components/VueScss.vue
@@ -0,0 +1,11 @@
+
+
+
+ Vue Sass
+
diff --git a/packages/astro/test/fixtures/0-css/src/pages/index.astro b/packages/astro/test/fixtures/0-css/src/pages/index.astro
new file mode 100644
index 000000000..599632065
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/pages/index.astro
@@ -0,0 +1,63 @@
+---
+import AstroComponent from '../components/Astro.astro';
+import AstroComponentNone from '../components/AstroNone.astro';
+import AstroSass from '../components/AstroSass.astro';
+import AstroScss from '../components/AstroScss.astro';
+import ReactCSS from '../components/ReactCSS.jsx';
+import ReactModules from '../components/ReactModules.jsx';
+import ReactModulesSass from '../components/ReactModulesSass.jsx';
+import ReactModulesScss from '../components/ReactModulesScss.jsx';
+import ReactSass from '../components/ReactSass.jsx';
+import ReactScss from '../components/ReactScss.jsx';
+import VueCSS from '../components/VueCSS.vue';
+import VueModules from '../components/VueModules.vue';
+import VueSass from '../components/VueSass.vue';
+import VueScoped from '../components/VueScoped.vue';
+import VueScss from '../components/VueScss.vue';
+import SvelteCSS from '../components/SvelteCSS.svelte';
+// import SvelteSass from '../components/SvelteSass.svelte';
+// import SvelteScss from '../components/SvelteScss.svelte';
+import ReactDynamic from '../components/ReactDynamic.jsx';
+---
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/astro/test/fixtures/0-css/src/styles/linked.css b/packages/astro/test/fixtures/0-css/src/styles/linked.css
new file mode 100644
index 000000000..5a782901d
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/styles/linked.css
@@ -0,0 +1,3 @@
+.linked-css {
+ color: gold;
+}
diff --git a/packages/astro/test/fixtures/0-css/src/styles/linked.sass b/packages/astro/test/fixtures/0-css/src/styles/linked.sass
new file mode 100644
index 000000000..4cc146850
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/styles/linked.sass
@@ -0,0 +1,2 @@
+.linked-sass
+ color: #778899
diff --git a/packages/astro/test/fixtures/0-css/src/styles/linked.scss b/packages/astro/test/fixtures/0-css/src/styles/linked.scss
new file mode 100644
index 000000000..e35bcd210
--- /dev/null
+++ b/packages/astro/test/fixtures/0-css/src/styles/linked.scss
@@ -0,0 +1,3 @@
+.linked-scss {
+ color: #6b8e23;
+}
diff --git a/packages/astro/test/fixtures/astro-styles-ssr/src/components/SvelteScoped.svelte b/packages/astro/test/fixtures/astro-styles-ssr/src/components/SvelteScoped.svelte
deleted file mode 100644
index 6e35a4c0d..000000000
--- a/packages/astro/test/fixtures/astro-styles-ssr/src/components/SvelteScoped.svelte
+++ /dev/null
@@ -1,7 +0,0 @@
-Svelte Scoped CSS
-
-
diff --git a/packages/astro/test/fixtures/astro-styles-ssr/src/components/VueCSS.vue b/packages/astro/test/fixtures/astro-styles-ssr/src/components/VueCSS.vue
deleted file mode 100644
index 23ac9a291..000000000
--- a/packages/astro/test/fixtures/astro-styles-ssr/src/components/VueCSS.vue
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- Vue Global CSS
-
diff --git a/packages/astro/test/fixtures/astro-styles-ssr/src/pages/index.astro b/packages/astro/test/fixtures/astro-styles-ssr/src/pages/index.astro
deleted file mode 100644
index 345d1b5bc..000000000
--- a/packages/astro/test/fixtures/astro-styles-ssr/src/pages/index.astro
+++ /dev/null
@@ -1,40 +0,0 @@
----
-import AstroComponent from '../components/Astro.astro';
-import AstroComponentNone from '../components/AstroNone.astro';
-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';
-import SvelteScoped from '../components/SvelteScoped.svelte';
-import ReactDynamic from '../components/ReactDynamic.jsx';
----
-
-
-
-
-
-
-
-
-
-
diff --git a/yarn.lock b/yarn.lock
index 3542bf4c6..35575082e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -8906,7 +8906,7 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2, safe-buffer@^5.2.1,
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
-sass@^1.43.3:
+sass@^1.43.4:
version "1.43.4"
resolved "https://registry.yarnpkg.com/sass/-/sass-1.43.4.tgz#68c7d6a1b004bef49af0d9caf750e9b252105d1f"
integrity sha512-/ptG7KE9lxpGSYiXn7Ar+lKOv37xfWsZRtFYal2QHNigyVQDx685VFT/h7ejVr+R8w7H4tmUgtulsKl5YpveOg==