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

2.0.0 version postcss-import bug #1127

Closed
waldnercharles opened this issue Jan 9, 2017 · 5 comments
Closed

2.0.0 version postcss-import bug #1127

waldnercharles opened this issue Jan 9, 2017 · 5 comments

Comments

@waldnercharles
Copy link

waldnercharles commented Jan 9, 2017

I'm not sure if this is someting that needs to be fixed on the react-toolbox side.

When I try to use postcss-import to import from react-toolbox/lib/[component]/theme.css, it is unable to find relative imports like ../helpers.css.

Are there any examples that use postcss-import using react-toolbox from npm?

@javivelasco
Copy link
Member

Can you give more context on this? Are you using a custom webpack config? This is usually happening because there are issues on how css-modules manage the paths. In react-toolbox-themr I needed to specify from option, check here. If this is not helpful, don't worry too much. We will remove the css module import for the next release, it generates too many issues.

@razor-x
Copy link

razor-x commented Jan 17, 2017

@waldnercharles
Copy link
Author

I believe this is a bug with css-loader (or css-modules-loader-core) and postcss-loader. I don't have a workaround for @razor-x, but instead of composes, we could use @apply from postcss-cssnext (which is using postcss-apply). It seems to be more stable, even if it hasn't been updated in a few months.

The syntax would change from composes: reset from '../helpers.css' to something like:

//helpers.css
:root {
  --reset {
    // ...
  }
}

// input/theme.css
@import '../helpers.css'
.input {
  @apply --reset;
}

Thoughts?

@javivelasco
Copy link
Member

This is generating a lot of issues, so I've tool @waldnercharles approach. Although the caveat is that now the CSS is not reused in the bundle, it's a good price to pay to skip these issues.

@razor-x
Copy link

razor-x commented Jan 18, 2017

I agree.

I remember at some point the plan was to distribute the package with css files already processed through postcss-import. If that is still happening then the first approach would only affect users attempting to import the unprocessed src files which should be rare and perhaps not officially supported, at least initially.

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