diff --git a/packages/angular-cli/models/webpack-build-common.ts b/packages/angular-cli/models/webpack-build-common.ts index aae14af6663c..2726873ff888 100644 --- a/packages/angular-cli/models/webpack-build-common.ts +++ b/packages/angular-cli/models/webpack-build-common.ts @@ -4,6 +4,7 @@ import {GlobCopyWebpackPlugin} from '../plugins/glob-copy-webpack-plugin'; import {BaseHrefWebpackPlugin} from '@angular-cli/base-href-webpack'; const HtmlWebpackPlugin = require('html-webpack-plugin'); +const autoprefixer = require('autoprefixer'); export function getWebpackCommonConfig( @@ -131,7 +132,13 @@ export function getWebpackCommonConfig( new GlobCopyWebpackPlugin({ patterns: appConfig.assets, globOptions: {cwd: appRoot, dot: true, ignore: '**/.gitkeep'} - }) + }), + new webpack.LoaderOptionsPlugin({ + test: /\.(css|scss|sass|less|styl)$/, + options: { + postcss: [ autoprefixer() ] + }, + }), ], node: { fs: 'empty', diff --git a/tests/e2e/tests/build/styles/css.ts b/tests/e2e/tests/build/styles/css.ts index aa081ef1f45c..7d49e5e94ba9 100644 --- a/tests/e2e/tests/build/styles/css.ts +++ b/tests/e2e/tests/build/styles/css.ts @@ -8,6 +8,8 @@ export default function() { @import './imported-styles.css'; body { background-color: blue; } + + div { flex: 1 } `, 'src/imported-styles.css': ` p { background-color: red; } @@ -15,5 +17,8 @@ export default function() { }) .then(() => ng('build')) .then(() => expectFileToMatch('dist/styles.bundle.js', 'body { background-color: blue; }')) - .then(() => expectFileToMatch('dist/styles.bundle.js', 'p { background-color: red; }')); + .then(() => expectFileToMatch('dist/styles.bundle.js', 'p { background-color: red; }')) + .then(() => expectFileToMatch( + 'dist/styles.bundle.js', + 'div { -webkit-box-flex: 1; -ms-flex: 1; flex: 1 }')); }