Skip to content

Commit 103cece

Browse files
committed
feat(@angular/cli): add fallback for CSS variables #7514
In order to integrate with CSS frameworks that use the "var" keyword, cssnext needs to be added to the build toolchain to preprocess the CSS rules. This also replaces the need to call autoprefixer directly.
1 parent a29af80 commit 103cece

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

packages/@angular/cli/models/webpack-configs/styles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { pluginArgs, postcssArgs } from '../../tasks/eject';
99

1010
const cssnano = require('cssnano');
1111
const postcssUrl = require('postcss-url');
12-
const autoprefixer = require('autoprefixer');
12+
const cssnext = require('postcss-cssnext');
1313
const ExtractTextPlugin = require('extract-text-webpack-plugin');
1414

1515
/**
@@ -78,14 +78,14 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
7878
}
7979
}
8080
}),
81-
autoprefixer(),
81+
cssnext(),
8282
].concat(
8383
minimizeCss ? [cssnano(minimizeOptions)] : []
8484
);
8585
};
8686
(postcssPluginCreator as any)[postcssArgs] = {
8787
variableImports: {
88-
'autoprefixer': 'autoprefixer',
88+
'postcss-cssnext': 'cssnext',
8989
'postcss-url': 'postcssUrl',
9090
'cssnano': 'cssnano'
9191
},

packages/@angular/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"nopt": "^4.0.1",
6262
"opn": "~5.1.0",
6363
"portfinder": "~1.0.12",
64+
"postcss-cssnext": "^3.0.2",
6465
"postcss-loader": "^1.3.3",
6566
"postcss-url": "^5.1.2",
6667
"raw-loader": "^0.5.1",

0 commit comments

Comments
 (0)