-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: pass Astro config postcss to Svelte preprocess (#3685)
* fix: pass Astro config postcss to Svelte preprocess * test: preset env for nested styles * chore: changeset
- Loading branch information
1 parent
a3654a7
commit 3d554fd
Showing
12 changed files
with
565 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'astro': patch | ||
'@astrojs/svelte': patch | ||
--- | ||
|
||
Fix PostCSS config not applied to Svelte component by default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
const postcssPresetEnv = require('postcss-preset-env') | ||
const autoPrefixer = require('autoprefixer') | ||
|
||
module.exports = { | ||
plugins: { | ||
autoprefixer: { | ||
plugins: [ | ||
// included to ensure public/ CSS resources are NOT transformed | ||
autoPrefixer({ | ||
overrideBrowserslist: ['> 0.1%', 'IE 11'] // enforce `appearance: none;` is prefixed with -webkit and -moz | ||
} | ||
} | ||
}; | ||
}), | ||
postcssPresetEnv({ features: { 'nesting-rules': true } }), | ||
] | ||
} |
8 changes: 5 additions & 3 deletions
8
packages/astro/test/fixtures/postcss/src/components/Astro.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<style> | ||
.astro-component { | ||
appearance: none; | ||
&.nested { | ||
color: red; | ||
} | ||
} | ||
</style> | ||
|
||
<div class="astro-component"> | ||
Astro | ||
<div class="astro-component nested"> | ||
Astro | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.solid { | ||
appearance: none; | ||
&.nested { | ||
color: red; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
packages/astro/test/fixtures/postcss/src/components/Svelte.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<style> | ||
.svelte { | ||
appearance: none; | ||
&.nested { | ||
color: red; | ||
} | ||
} | ||
</style> | ||
|
||
<div class="svelte"> | ||
Svelte | ||
<div class="svelte nested"> | ||
Svelte | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
<style> | ||
.vue { | ||
appearance: none; | ||
&.nested { | ||
color: red; | ||
} | ||
} | ||
</style> | ||
|
||
<template> | ||
<div class="vue"> | ||
Vue | ||
<div class="vue nested"> | ||
Vue | ||
</div> | ||
</template> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.