Using the following postcss plugins:
- postcss-cssnext
- postcss-nested
- postcss-color-function
I constantly hit the following error, when using the following color function.
Unable to parse color from string "l(-20%)"
styles.css
@import 'variables.css';
// ^-- contains: --blue: #3892e0;
& a {
color: color(var(--blue), l(-20%));
&:hover {
color: color(var(--blue), l(0%));
}
}
Webpack 2 snippet
{
loader: 'postcss-loader',
options: {
plugins: [
cssImport({ path: './src' }),
cssnext({ browsers: ['last 2 versions'] }),
colorFunction(),
nested(),
],
}
}
The error, although not descriptive, is indicating that the
,
is unneeded. This follows future CSS (proposed) spec, but can be a nasty habit to drop if you come from any other language.The solution is simply to remove the
,
's: