Let copy-assets own public/ instead of guarding build-css writes (#3007)

Fixes #3006
This commit is contained in:
ethancrawford authored and GitHub committed 2026-09-12 17:58:02 +02:00
1 parent ede09742fe
commit 1dbabb5c0b
5 files changed
+18 -14

No files matched your search

+6 -4
View File
@@ -136,7 +136,11 @@ export default defineConfig({
},
{
// demo css built by this package's sass pipeline, from tmp-assets/
// (not dist/, which is Astro's own build output — see copy-assets.ts).
// (the `css` and `watch:css` scripts both write there). Not dist/,
// which is Astro's own build output — see copy-assets.ts — and not
// public/, which copy-assets wipes on every restart: anything a
// watcher writes straight into public/ is lost, or worse, racing
// with the wipe (#3006).
from: path('./tmp-assets'),
to: path('./public/preview'),
label: '@tabler/preview',
@@ -156,11 +160,9 @@ export default defineConfig({
// reads from — same directory.
syncDirs: [
{ from: path('../core/dist'), to: path('./public/dist') },
{ from: path('./tmp-assets'), to: path('./public/preview') },
{ from: path('../shared/static'), to: path('./public/static') },
],
// watch:css writes straight into public/preview — the file is already
// in place, but Astro does not reload the browser on public/ changes.
reloadDirs: [path('./public/preview')],
}),
mdx(),
dropPlaygrounds(),
+1 -1
View File
@@ -9,7 +9,7 @@
"scripts": {
"assets": "shx rm -rf tmp-assets && pnpm run css",
"css": "tsx ../.build/build-css.ts scss tmp-assets/css --minify",
"watch:css": "nodemon --watch scss/ --ext scss --exec \"tsx ../.build/build-css.ts scss public/preview/css\"",
"watch:css": "nodemon --watch scss/ --ext scss --exec \"tsx ../.build/build-css.ts scss tmp-assets/css\"",
"watch": "pnpm run watch:css",
"dev": "concurrently -n astro,css -c blue,magenta \"astro dev\" \"pnpm run watch:css\"",
"dev:prepare": "pnpm run assets",