Skip to content

Commit 0fb8de9

Browse files
authored
Add watchFiles option to CSS config for improved file watching (#7562)
1 parent d757429 commit 0fb8de9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/survey-creator-core/rollup.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export default async (options) => {
176176
dir: buildPath,
177177
emitMinified: process.env.emitMinified === "true",
178178
version: pkg.version,
179+
watchFiles: [resolve(buildPath, "survey-creator-core.fontless.css")],
179180
onCloseBundle: async() => {
180181
for (const path of [resolve(buildPath, "survey-creator-core.css"), resolve(buildPath, "survey-creator-core.min.css")]) {
181182
if (fs.existsSync(path)) {

rollup.helpers.mjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export function createEsmConfig(options) {
244244

245245
export function createCssConfig(options) {
246246

247-
const { input, dir, emitMinified, version, onCloseBundle } = options;
247+
const { input, dir, emitMinified, version, onCloseBundle, watchFiles } = options;
248248

249249
if (Object.keys(input).length > 1) throw Error("css config accepts only one input");
250250

@@ -254,6 +254,14 @@ export function createCssConfig(options) {
254254
input: value,
255255
output: [{ file: resolve(dir, `${name}.omitted`) }],
256256
plugins: [
257+
watchFiles && {
258+
name: "watch-extra-files",
259+
buildStart() {
260+
for (const file of watchFiles) {
261+
this.addWatchFile(file);
262+
}
263+
}
264+
},
257265
rollupPostcss({
258266
extract: true,
259267
minimize: false,

0 commit comments

Comments
 (0)