Skip to content

preprocessCss is no longer run on composed files #115

Open

Description

@willdawsonme

Since css-modules-require-hook started using postcss-modules-resolve-imports (v4.2.2), preprocessCss is no longer being called on composed files, which makes using this module with stylus impossible if you use composes.

For example, this:

// src/components/Home/styles.styl
.header
    composes: header from '../styles/page.styl'

should give me:

// src/components/Home/index.js
styles = {
    header: 'styles__header__abcd page__header__abcd',
}

but instead I get:

// src/components/Home/index.js
styles = {
    header: 'styles__header__abcd header',
}

because page.styl isn't being preprocessed before postcss is run.

Activity

  1. XOP commented on May 31, 2018

    @XOP

    Finally! that's the crux of the matter I've been struggling with for 2 days... Thanks @willdawsonme!

    My setup runs exclusively on .scss modules, but the reason it fails is the same - no call on composed files, as mentioned above.
    Had to resort to 4.2.1 to make it work.

    Perhaps it wouldn't be the case if it was different setup. In my case it's modules nesting that produce such results.

    P.S. I use require hook only for testing purposes.

  2. birdofpreyru commented on Apr 17, 2020

    @birdofpreyru

    If anybody is still interested, I presumably fixed this in my fork of the library, published to NPM: https://www.npmjs.com/package/@dr.pogodin/css-modules-require-hook

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions