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

keepImport is incorrect when extractCss is used #83

Open
danoc opened this issue Apr 5, 2018 · 2 comments
Open

keepImport is incorrect when extractCss is used #83

danoc opened this issue Apr 5, 2018 · 2 comments

Comments

@danoc
Copy link

danoc commented Apr 5, 2018

Hello! I'm using preprocessCss and extractCss to convert a SCSS file to CSS then store it in my library's dist folder. I also use keepImport.

The import in the JS file points to the SCSS file. Unfortunately, it seems that there is no way to convert the generated require to point to the compiled CSS that extractCss copied to the dist.

Is this something worth adding to the plugin? If so, I might take a pass at it.

@kentandersen
Copy link

kentandersen commented May 1, 2018

👍 I would love this feature to :)

@CPatchane
Copy link

CPatchane commented Dec 7, 2018

Hello! I get into this issue so it could be great to have this handling automatically 👍
But, waiting that, I find a not documented option named importPathFormatter in the code which allows to custom the require path here. Here is the usage :

// importPathFormatter.js
module.exports = path => path.replace(/\.scss$/, '.css')
// .babelrc
...
    "plugins": [
       ["css-modules-transform", {
         ...
         "importPathFormatter": "./importPathFormatter",
         ...
        }
    ]
...

In

require('./mystyle.scss')

Out

require('./mystyle.css')

@michalkvasnicak Is this just a missing documentation or this option should not be used for a reason? I could make a PR if this is just about documentation.
Hope this helps!

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

3 participants