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

Error when using with PostCSS 6.0.2 #4

Open
jeremyfrank opened this issue Jun 27, 2017 · 6 comments
Open

Error when using with PostCSS 6.0.2 #4

jeremyfrank opened this issue Jun 27, 2017 · 6 comments

Comments

@jeremyfrank
Copy link

Got the error below when trying out this plugin for the first time, in a PostCSS plugin stack that looks like this:

postcss-easy-import
postcss-nesting
postcss-strip-units
postcss-cssnext
postcss-normalize
postcss-reporter

Your current PostCSS version is 6.0.2, but postcss-strip uses 5.2.17. Perhaps this is the source of the error below.

events.js:160
      throw er; // Unhandled 'error' event
      ^
TypeError: Could not parse `strip(var(--column))`. Got `NaN`
    at /project-directory/node_modules/postcss-strip-units/lib/transformStrip.js:27:19
    at evalFunctionCall (/project-directory/node_modules/reduce-function-call/index.js:73:10)
    at /project-directory/node_modules/reduce-function-call/index.js:23:82
    at Array.reduce (native)
    at reduceFunctionCall (/project-directory/node_modules/reduce-function-call/index.js:22:47)
    at transformStrip (/project-directory/node_modules/postcss-strip-units/lib/transformStrip.js:4:12)
    at transformStripValue (/project-directory/node_modules/postcss-strip-units/index.js:15:34)
    at Object.tryCatch [as try] (/project-directory/node_modules/postcss-message-helpers/index.js:53:12)
    at transformValue (/project-directory/node_modules/postcss-strip-units/index.js:14:24)
    at /project-directory/node_modules/postcss-strip-units/index.js:23:24
@whitneyit
Copy link
Owner

Are you able to post the code that you used that generated this error?

@jeremyfrank
Copy link
Author

A streamlined version, with plugins previously required, is:

const plugins = [
  easyImport({plugins: [stylelint]}),
  mixins(),
  strip(),
  units(), // provides em() and rem() functions
  nesting(), // use a more update version of postcss-nesting
  cssnext(),
  normalize({forceImport: true}),
  reporter({clearReportedMessages: true})
]

return gulp.src(paths.src)
  .pipe(postcss(plugins))
  .pipe(gulp.dest(paths.dest))
  .pipe(browserSync.stream())

I think the issue may be that cssnext internally includes the custom properties and the calc plugins, but the usage instructions for strip-units show it being required in between those two plugins.

@cuiyajie
Copy link

I have same problem.

@mjschlot
Copy link
Contributor

It is not clear what the cause of the error is that you are reporting, but I can make some guesses and they would be resolved as part of a pull request I submitted recently:
#5

@whitneyit
Copy link
Owner

@jeremyfrank, @cuiyajie, are you able to confirm that this works with version 2.0.1?

@jeremyfrank
Copy link
Author

Seems to be working fine with 2.0.1!

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

4 participants