File tree 3 files changed +21
-5
lines changed
3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " microsite " : patch
3
+ ---
4
+
5
+ Remove PostCSS logic from core dependencies. Microsite will prompt users to install PostCSS locally if detected.
Original file line number Diff line number Diff line change 45
45
"dependencies" : {
46
46
"@prefresh/snowpack" : " ^3.0.1" ,
47
47
"@snowpack/plugin-dotenv" : " ^2.0.5" ,
48
- "@snowpack/plugin-postcss" : " ^1.0.11" ,
49
48
"arg" : " ^5.0.0" ,
50
49
"cacache" : " ^15.0.5" ,
51
50
"cosmiconfig" : " ^7.0.0" ,
58
57
"open" : " ^7.3.0" ,
59
58
"path-browserify" : " ^1.0.1" ,
60
59
"polka" : " ^0.5.2" ,
61
- "postcss" : " ^8.2.1" ,
62
- "postcss-cli" : " ^8.3.1" ,
63
- "postcss-flexbugs-fixes" : " ^5.0.2" ,
64
- "postcss-preset-env" : " ^6.7.0" ,
65
60
"preact" : " ^10.5.5" ,
66
61
"preact-render-to-string" : " 5.1.11" ,
67
62
"prettier" : " ^2.1.2" ,
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const require = createRequire(import.meta.url);
6
6
import { fileExists } from "./fs.js" ;
7
7
import { createConfiguration } from "snowpack" ;
8
8
import cc from "cosmiconfig" ;
9
+ import { yellow } from "kleur/colors" ;
9
10
const { cosmiconfig } = cc ;
10
11
const _config = require ( "microsite/assets/snowpack.config.cjs" ) ;
11
12
@@ -40,6 +41,21 @@ export async function loadConfiguration(mode: "dev" | "build") {
40
41
: { } ;
41
42
const userConfig = snowpackconfigPath ? require ( snowpackconfigPath ) : { } ;
42
43
44
+ if ( usesPostCSS ) {
45
+ const missing = [ ] ;
46
+ const deps = [ '@snowpack/plugin-postcss' , 'postcss' , 'postcss-cli' ] ;
47
+ deps . forEach ( dependency => {
48
+ try {
49
+ require . resolve ( dependency ) ;
50
+ } catch ( e ) {
51
+ missing . push ( dependency ) ;
52
+ }
53
+ } ) ;
54
+ if ( missing . length > 0 ) {
55
+ console . error ( yellow ( `It looks like you're trying to use PostCSS!\nMicrosite will automatically use your configuration, but requires some 'devDependencies' to do so.\n\nPlease run 'npm install --save-dev ${ missing . join ( ' ' ) } '\n` ) ) ;
56
+ process . exit ( 1 ) ;
57
+ }
58
+ }
43
59
const additionalPlugins = usesPostCSS ? [ "@snowpack/plugin-postcss" ] : [ ] ;
44
60
45
61
switch ( mode ) {
You can’t perform that action at this time.
0 commit comments