Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twig file changes are not working with "watch" or "dev-server" #1246

Open
sovetski opened this issue Jan 1, 2024 · 1 comment
Open

Twig file changes are not working with "watch" or "dev-server" #1246

sovetski opened this issue Jan 1, 2024 · 1 comment

Comments

@sovetski
Copy link

sovetski commented Jan 1, 2024

I am using bootstrap and to avoid getting all unused classes for my build folder, I am also using "postcss-purgecss" which removes unused classnames.

The problem is that webpack does not load my postcss config if there is no changed files by "watch", if I add "mt-5" classname for example, it will not detect this change because it is inside a ".twig" file and not "js or css". To be able to get the "mt-5" class i need to do some changes inside "assets" or re run the "npm run watch"...

I tested this solution: https://symfony.com/doc/current/frontend/encore/dev-server.html#live-reloading-when-changing-php-twig-files

// webpack.config.js
// ...

Encore
    // ...

    .configureDevServerOptions(options => {
        options.liveReload = true;
        options.static = {
            watch: false
        };
        options.watchFiles = {
            paths: ['src/**/*.php', 'templates/**/*'],
        };
    })

It reloads the browser on each twig file change which is cool, but it does not reloads my assets, I need to change any css or js file to be able to get my classname built

Originally posted by @sovetski in #1026 (comment)

@sovetski
Copy link
Author

sovetski commented Feb 4, 2024

After spending some days, I found an alternative solution, you can see here: webpack/webpack#17918 (comment)

But I hope we will get an official default integrated solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant