如何制作滚动CLI手表。包括多个文件或目录?

发布于 2025-02-12 08:38:55 字数 242 浏览 0 评论 0原文

我正在开始观看使用的汇总过程:

npx rollup -c rollup.config.js --watch --watch.include=js/**

但是现在我想添加一个我也想观看的第二个目录:样式/**

chan i如何更改命令,以便 js样式目录正在观察?

I'm starting a rollup process with watching using:

npx rollup -c rollup.config.js --watch --watch.include=js/**

But now I want to add a second directory that I want to watch as well: styles/**

How chan I change the command so that both the js and styles directories are being watched?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假面具 2025-02-19 08:38:55

编辑:这似乎不再适用于较新版本的汇总。相反,我现在只添加

{
    watch: {
        include: ["js/**", "styles/**"]
    }
}

到汇总配置中。


旧答案:

如果您是通过lolup.config.json配置观察者“ rel =“ nofollow noreferrer”> watch.include属性。但是在CLI上这不是一个选择。

但是,您可以更改命令中的环模式,使其包含多个模式(请参见此答案)。

那么您的命令将成为:

npx rollup -c rollup.config.js --watch --watch.include=*(js/**|styles/**)

edit: this no longer seems to work with a newer version of rollup. Instead I now simply add

{
    watch: {
        include: ["js/**", "styles/**"]
    }
}

to the rollup config.


old answer:

If you are configuring your watcher from your rollup.config.json you could simply use an array for the watch.include property. But on the CLI this is not an option.

You could, however, change the glob pattern in the command so that it contains multiple patterns (see this answer).

Then your command would become:

npx rollup -c rollup.config.js --watch --watch.include=*(js/**|styles/**)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文