Commit e8eff00
committed
π Always run PostCSS over Vue <style> blocks in clay compile scripts
CLAYCLI_COMPILE_SCRIPTS_SKIP_STYLE_POSTCSS was treating two unrelated
concerns as a single switch:
1. The PostCSS plugin chain (cssImport β autoprefixer β mixins β
nested β simple-vars), needed for every <style> block to flatten
`&-foo` nesting and resolve simple variables.
2. The sass/scss preprocessor (node-sass β dart-sass), introduced to
dodge node-sass native-binding failures in some Docker stages.
When the env var was set, the chain in (1) was disabled too, so kiln
plugin <style> blocks reached the browser as nested CSS no UA can
parse. Modals built from local .vue files (article-picker, agora,
mediaplay-picker, β¦) consequently rendered unstyled β even on sites
served by the existing Browserify pipeline.
This commit decouples them: the PostCSS chain now always runs; the env
var only swaps in the dart-sass preprocessor.
Plugins are resolved from the host project's node_modules first so the
chain runs against the host's PostCSS major. If the host has no PostCSS
installed at all, claycli's bundled copies are used instead. Mixing the
two trees is avoided β picking individual plugins across versions
triggers "PostCSS plugin X requires PostCSS Y" failures because each
plugin's `Symbol.for('postcss')` is anchored to whichever postcss it
was installed alongside. Plugins absent from the chosen tree are
dropped silently (postcss-mixins is a transitive of vueify only and may
legitimately be absent from a host).
Verified locally on nymag/sites: clay compile scripts emits a 65 KB
_kiln-plugins.css with zero raw `&-` selectors (was 56 KB / 180 nested
matches), and the agora / article-picker modals render correctly.
Companion to the equivalent fix in lib/cmd/vite/plugins/vue2.js so the
two pipelines produce equivalent output for kiln plugin SFCs.
Made-with: Cursor1 parent 6537199 commit e8eff00
1 file changed
Lines changed: 87 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
69 | 131 | | |
70 | 132 | | |
71 | 133 | | |
| |||
377 | 439 | | |
378 | 440 | | |
379 | 441 | | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
392 | 462 | | |
393 | 463 | | |
394 | 464 | | |
| |||
0 commit comments