Dec 22, 2020
0
Level 1
Inifinite loop on watch with mix, postcss and string replace
I'm a realtive dunce when it comes to laravel mix so please bear with me...
I'm trying to compile my scss and then run string replace to replace the compiled colour values with css vars. Running dev or prod works fine however when running a watch it just loops forever. I can guess that it is just constantly seeing the css is altered and recompiling over and over but I'm at a loss at how to fix it.
It's an older project running mix 4
mix.sass('src/scss/app.scss', 'web/dist/')
.postCss('web/dist/app.css', 'web/dist')
.stringReplace({
test: /app\.css/,
loader: 'string-replace-loader',
options: {
multiple: [
{search: '\#c20910', replace: 'var(--primary-color)', flags: 'g'},
{search: '\#002a5c', replace: 'var(--secondary-color)', flags: 'g'}
]
}
})
.version();
Please or to participate in this conversation.