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

importing local class name from another less/sass module with variable returns error #122

Closed
juhaelee opened this issue Aug 8, 2015 · 4 comments

Comments

@juhaelee
Copy link

juhaelee commented Aug 8, 2015

I'm getting an error saying Module not found: Error: Cannot resolve module when I try and compose from a file that has a LESS/SASS variable.

For example, say I have a less file (A.less):

@import "./styles/colors.less" // contains @black: #000000

.A {
   color: @black
}

and if I try and compose from a different less file (B.less):

.B {
   composes: color from "./A.less"
}

I get the error. I believe it's because css-loader is trying to read the @import statement in A.less as a module?

@juhaelee juhaelee changed the title importing local class name from another less/sass module returns error importing local class name from another less/sass module with variable returns error Aug 8, 2015
@sokra
Copy link
Member

sokra commented Aug 12, 2015

can you pass the full error?

@mrlaessig
Copy link

Same issues with other preprocessors #131. To workaround this you can use a preprocessor loader in your style file.

:local(.composesClass)
  composes: classInFile from 'stylus!./otherFile.styl'
...

But for some reasons the styles from the 'from files' getting added twice to the to the html head.

@SleepWalker
Copy link

probably you should use importLoaders=n loader option to tell that you need to use n preceding loaders before css-loader

@markdalgleish
Copy link
Contributor

What @SleepWalker suggested sounds like the solution to this issue as this is something I've also experienced. Closing for now, but please re-open if this isn't the case.

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

5 participants