Skip to content
This repository was archived by the owner on Aug 28, 2026. It is now read-only.
This repository was archived by the owner on Aug 28, 2026. It is now read-only.

Imported local aliases not working when used in selectors #561

Closed

Description

@apexskier

Reporting css-modules/icss#12 for visibility. I'll copy the details, but I'm experiencing the exact same issue.

Do you want to request a feature or report a bug?
bug report

What is the current behavior?

// foo.scss
.foo {
    color: blue;
}

// bar.css
:import("foo.css") {
    fooClassName: foo;
}
.fooClassName .bar { // <-- this doesn't get replaced :(
    color: red;
}

// baz.css
:import("foo.css") {
    fooClassName: foo;
}
.baz {
    color: fooClassName; // <-- this does get replaced :)
}

What is the expected behavior?
fooClassName is replaced with the local name for foo from foo.css in both bar.scss and `baz.scss

Please mention other relevant information such as your webpack version, Node.js version and Operating System.
I'm currently testing with webpack 2.2.1, node 7.2.1, css-loader 0.28.4.

Activity

  1. apexskier commented on Jun 23, 2017

    @apexskier
    Author

    It looks like this mght be fixed in a newer version of icss-utils css-modules/icss-utils@19ffee9

    However, linking a local version of css-loader with icss-utils upgraded doesn't resolve the problem.

  2. apexskier commented on Jun 23, 2017

    @apexskier
    Author

    Okay, I'm diving in and have this PR, which partially solves this -- css-modules/postcss-icss-selectors#119 -- with a PR for this repo as well. It'll require updating to the more recent version of css-modules' icss loaders, but seems to be working well locally.

  3. michael-ciniawsky commented on Jun 23, 2017

    @michael-ciniawsky
    Contributor

    Did you see the new-loader branch ? I highly appreciate your current work, but we need to be careful to not introduce breaking changes within the semver minor range of this loader atm. The intemediate goal is to release a new semver major of css-loader and move CSSM to postcss-loader as a standalone plugin, while css-loader only parses the ICSS Tokens. postcss-modules (Plugin Wrapper), postcss-loader (result.messages [ICSS Tokens Export]) and import @media query parsing (ICSS v2) are missing. In case your upcoming PR is backwards compatible forget what I said then 😛

  4. apexskier commented on Jun 23, 2017

    @apexskier
    Author

    Oh cool, that's very good to know. I was thinking about how it would be nice to use postcss for my modules, but the fact that the loader needs to know about the exports was blocking. That sounds like it'll help a lot with my issues.

    I've got a draft of the PR and it might be backwards compatible (just need to investigate why some tests are failing). I'm going to push it up just so folks can look at it, but if it turns out to not be backwards compatible I won't worry.

  5. alexander-akait commented on Feb 13, 2018

    @alexander-akait
    Member

    Closing if favor css-loader/next and postcss-loader or css as first citizen in webpack. It is rfc/porpalse and should be resolve in https://github.com/css-modules/icss. Thanks for issue!

  6. apexskier commented on May 22, 2018

    @apexskier
    Author

    What's the status on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions