Problem using argument `--watch` and `--replace`
onmax opened this issue · 2 comments
This issue is related to: #126
I understand that using --watch
and --replace
can create an infinite loop, but then is there another way to trigger the postcss cli to replace the content of the CSS?
To be more specific, I am using lit
and litelement
to build some webcomponents. I am using the template developed by open-wc, and I want to add postCSS/Tailwind to my development stack. In the template, there is this a command tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"
that basically compiles the components and serves a webpage where you can see the changes.
I would like to run a command similar to postcss ./dist/src/my-component.js --replace --watch
, so then it builds the tailwindCSS and works fine with hotreload, but it is not possible at all, so I guess I am not the first one with this issue, and I would like to know how others managed to solved this issue triggering the posstcss command in any other way.
If I run postcss ./dist/src/my-component.js
, the result is the expected output. So, I believe, that all my plugins and postcss configurations are OK
The solution here is to have separate source and output files. We can't have them both work, because we have no way of knowing why the file changed in watch mode; was it because you edited it? Or was it because we wrote the output? If the latter, we get stuck in an infinite loop.
Yes, I understand the problem. But I was wondering if there was any other method. Thanks anyway!