@theme-json/create
Version:
Split WordPress theme.json into smaller files.
27 lines (26 loc) • 601 B
JavaScript
/**
* External dependencies
*/
import chokidar from 'chokidar';
/**
* Internal dependencies
*/
import build from '../lib/build.mjs';
import { getConfig } from '../utils/index.mjs';
async function watch() {
const configs = await getConfig();
// Initial build
await build();
const roots = configs.map((config) => config.src);
// Watch for changes
chokidar
.watch(roots, {
ignoreInitial: true,
ignored: /.*\.temp-fresh-import\.[mc]js$/,
})
.on('all', (event, path) => {
console.log(event, path);
build();
});
}
watch();