Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Using env (previously constant) in a calc #452

Closed
gpmcadam opened this issue Mar 19, 2018 · 5 comments
Closed

Using env (previously constant) in a calc #452

gpmcadam opened this issue Mar 19, 2018 · 5 comments

Comments

@gpmcadam
Copy link

Using env (previously constant) within a calc throws a syntax error e.g.

padding-left: calc(10px + env(safe-area-inset-left));

This should be valid CSS, but postcss-cssnext flags it as a syntax error:

Error: Parse error on line 1: 10px + env(safe-area-inset- -------^ Expecting 'SUB', 'LPAREN', 'NESTED_CALC', 'NUMBER', 'CSS_VAR', 'LENGTH', 'ANGLE', 'TIME', 'FREQ', 'RES', 'EMS', 'EXS', 'CHS', 'REMS', 'VHS', 'VWS', 'VMINS', 'VMAXS', 'PERCENTAGE', got 'PREFIX'

See:

@vadikom
Copy link

vadikom commented Apr 11, 2018

I ran into the same issue. For now, the only solution I've figured is disabling reduce-css-calc - e.g.:

require('postcss-cssnext')({
  features: {
    calc: false
  }
  ...

Of course, this has its own implications.

@gpmcadam
Copy link
Author

@vadikom Thanks for the response.

Is this something that should be raised as an issue with reduce-css-calc do you think?

@vadikom
Copy link

vadikom commented Apr 11, 2018

I believe it's actually a known issue:

MoOx/reduce-css-calc#34

@jonathantneal
Copy link
Collaborator

Possibly resolved by #445 as a side effect of dropping calc minification.

@MoOx
Copy link
Owner

MoOx commented May 29, 2018

postcss-cssnext has been deprecated in favor of postcss-preset-env. Read more at https://moox.io/blog/deprecating-cssnext/

@MoOx MoOx closed this as completed May 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants