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

Create the possibility to overwrite the style loader and generally the loader settings #714

Closed
tooltonix opened this issue Mar 21, 2020 · 1 comment

Comments

@tooltonix
Copy link

tooltonix commented Mar 21, 2020

Hello,

i am new to Webpack Encore and am currently trying to override the style loader settings. During development I use the style loader in devServer and have disabled CSS extraction (Encore.disableCssExtraction()). I'm trying to override the style loader options and couldn't find a way to do so in Webpack Encore. So I now iterate the webpackConfig.module.rules to look for the settings there, which I find a bit ugly. Besides the function configureCssLoader() is there also a function configureStyleLoader() or a more elegant way to override the settings of the StyleLoader?

My code looks like this:

`
if (Encore.isDevServer()) {

Encore.disableCssExtraction();
for (rule of webpackConfig.module.rules) {
    if (rule.test.toString().match(/s\[ac\]ss/)) {
        if (rule.oneOf) {
            for (let set of rule.oneOf) {
                set.use[0] = {
                    loader: 'style-loader',
                    options: {
                        ...
                    }
                };
            }
        }
    }
}

`

@tooltonix
Copy link
Author

tooltonix commented Mar 21, 2020

made a pull-request in #715

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