gladkih / postcss-units

MIT License
12 stars 3 forks source link

can't use calc with this plugin #7

Closed claudewowo closed 6 years ago

claudewowo commented 6 years ago

image

css: font-size: calc(700% - rem(90));

error: Module build failed: Error: Parse error on line 1: 700% - rem(90) -------^ Expecting 'SUB', 'LPAREN', 'NESTED_CALC', 'NUMBER', 'CSS_VAR', 'LENGTH', 'ANGLE', 'TIME', 'FREQ', 'RES', 'EMS', 'EXS', 'CHS', 'REMS', 'VHS', 'VWS', 'VMINS', 'VMAXS', 'PERCENTAGE', got 'PREFIX'

gladkih commented 6 years ago

I'll see what I can do.

claudewowo commented 6 years ago

There is another case, using the postcss-cssnext plugin before the postcss-units, it will be two units in css, like this:
image If using the postcss-units plugin before the postcss-cssnext, u will get error information below:

Module build failed: Error: Parse error on line 1: 700% - rem(90) -------^ Expecting 'SUB', 'LPAREN', 'NESTED_CALC', 'NUMBER', 'CSS_VAR', 'LENGTH', 'ANGLE', 'TIME', 'FREQ', 'RES', 'EMS', 'EXS', 'CHS', 'REMS', 'VHS', 'VWS', 'VMINS', 'VMAXS', 'PERCENTAGE', got 'PREFIX'

It's my config in the postcss.config.js:

module.exports = { plugins: [ require('postcss-import')({ path: ['resources/assets/'] }), require('postcss-assets')({ loadPaths: ['resources/assets/common/'] }), require('postcss-nested'), require('postcss-color-function'), require('postcss-mixins'), require('postcss-extend'), require('postcss-units')({ size: 75, fallback: false, precision: 4 }), require('postcss-cssnext'), require('cssnano')({ sourcemap: true, safe: true, discardComments: { removeAll: false, }, discardUnused: false, zindex: false, }), ] }

I hope you can help me, 3Q~

gladkih commented 6 years ago

This case work. Look this test https://github.com/gladkih/postcss-units/blob/master/test.js#L70