Skip to content

Usage with postcss-import and postcss-mixins #108

Open
@penx

Description

@penx

See this example project:

https://github.com/penx/postcss-import-values-mixins

I have a css file (src/main.css) that imports another CSS file with a mixin:

@import "./mixins/fonts";

The mixin css file loads a variable:

@value title_font from '../variables/fonts.css';

But when running npm run webpack, I receive the error:

    ERROR in ./node_modules/css-loader?{"importLoaders":1}!./node_modules/postcss-loader/lib!./src/main.css
    Module not found: Error: Can't resolve '../variables/fonts.css' in '/postcss-import-values-mixins/src'

If I change the path to the variables css file to this:

@value title_font from './variables/fonts.css';

(using . rather than ..)

...then it works. But this is not the correct path relative to the file it is in.

This seems to indicate that postcss is trying to process the path to the src/variables/fonts.css file relative to src/main.css, rather than relative to src/mixins/fonts.css.

Is this a bug, or is there an issue with my configuration?

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