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

Allow modules options without disabling autoModules #291

Closed
wants to merge 1 commit into from

Conversation

developit
Copy link

@developit developit commented Jun 26, 2020

This adds an explicit autoModules:true option that forces isModuleFile() behavior even if options.modules is truthy. This is important because options.modules can be necessary to configure the behavior of postcss-modules, but currently doing so also forces postcss-modules to be run on 100% of files.

Example:

postcss({
  autoModules: true,
  modules: {
    generateScopedName: '_[hash:base64:5]'
  }
})

Current Behavior:

The above object value for options.modules is truthy, which causes postcss-modules to be executed against all files.

Behavior with this change:

Since autoModules is explicitly set to true, options.modules being a (truthy) object does not override automatic module behavior, so postcss-modules is only executed against files ending in .module.css.

This adds an explicit `autoModules:true` option that forces isModuleFile() behavior even if `options.modules` is truthy. This is important because `options.modules` can be necessary to configure the behavior of postcss-modules, but currently doing so also forces postcss-modules to be run on 100% of files.
@codecov
Copy link

codecov bot commented Jun 26, 2020

Codecov Report

Merging #291 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #291   +/-   ##
=======================================
  Coverage   92.47%   92.47%           
=======================================
  Files          10       10           
  Lines         319      319           
  Branches      112      112           
=======================================
  Hits          295      295           
  Misses         23       23           
  Partials        1        1           
Impacted Files Coverage Δ
src/postcss-loader.js 91.91% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9489eca...b021896. Read the comment docs.

@egoist
Copy link
Owner

egoist commented Jul 14, 2020

Fixed by #292

@egoist egoist closed this Jul 14, 2020
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

Successfully merging this pull request may close these issues.

2 participants