csstools/precss

Could not resolve the variable ... within ...

jesperlandberg opened this issue · 3 comments

Could not resolve the variable ... within ...

Anyone know why I get this error?

mixin im trying to setup:

@define-mixin font-size $val {
  font-size: calc($val * (100vw / var(--base-grid)));
}

postcss.config.js

module.exports = {
  plugins: {
    'precss': {},
    'postcss-for': {},
    'cssnano': {}
  }
}

Many thanks! I also get a same question

Is the mixin being imported from another stylesheet? If so it may be related to csstools/postcss-advanced-variables#71

I was getting the precss could not resolve the variable ___ within ___ error, and I was able to resolve the issue by changing my processing workflow. I'm using PostCSS inside a Gulp task, and my gulp.src included all my CSS files, including the files which had variables. I changed my gulp.src to only include my style.css file, which imports other files which define and make use of various variables, and that resolved the problem.