WP test container created
This commit is contained in:
+14
-9
@@ -27,22 +27,24 @@ export default defineConfig(({ mode }) => {
|
||||
// without rebuilding.
|
||||
base: './',
|
||||
|
||||
// `site/` mirrors the live asset tree, so the demo can reference
|
||||
// /wp-content/includes/images/… exactly as a WordPress template does.
|
||||
publicDir: here('site'),
|
||||
// No public directory. It used to point at `site/`, which mirrored the
|
||||
// live asset tree — but `site/` is now a WordPress install, and a demo
|
||||
// build would copy the whole of it into demo-dist/. Every image the
|
||||
// stylesheet needs is a Vite asset under src/images/ instead, which is
|
||||
// also what makes the bundle resolve at whatever path it is dropped.
|
||||
publicDir: false,
|
||||
|
||||
css: {
|
||||
devSourcemap: true,
|
||||
},
|
||||
|
||||
build: {
|
||||
outDir: isDemo ? here('demo-dist') : here('dist'),
|
||||
// The build emits straight into the theme, so the theme always runs the
|
||||
// current stylesheet with no copy step and there is no `dist/` to keep in
|
||||
// sync. The theme's `assets/` is a build artifact and is not versioned.
|
||||
outDir: isDemo ? here('demo-dist') : here('site/wp-content/themes/tlig/assets'),
|
||||
emptyOutDir: true,
|
||||
|
||||
// The demo needs the wood and scroll images; the deliverable does not —
|
||||
// WordPress already hosts them.
|
||||
copyPublicDir: isDemo,
|
||||
|
||||
sourcemap: true,
|
||||
cssCodeSplit: false,
|
||||
|
||||
@@ -59,7 +61,10 @@ export default defineConfig(({ mode }) => {
|
||||
assetFileNames: (info) => {
|
||||
const name = info.names?.[0] ?? info.name ?? ''
|
||||
if (name.endsWith('.css')) return 'tlig.css'
|
||||
if (/\.(woff2?|ttf|eot|svg)$/.test(name)) return 'fonts/[name][extname]'
|
||||
if (/\.(woff2?|ttf|eot)$/.test(name)) return 'fonts/[name][extname]'
|
||||
// Stable, unhashed image paths: the theme preloads the parchment,
|
||||
// so its URL must not change on every build.
|
||||
if (/\.(webp|png|jpe?g|svg|avif)$/.test(name)) return 'images/[name][extname]'
|
||||
return 'assets/[name]-[hash][extname]'
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user