Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoprefixer not working for serving prod builds #3156

Closed
miniplus opened this issue Nov 16, 2016 · 6 comments
Closed

autoprefixer not working for serving prod builds #3156

miniplus opened this issue Nov 16, 2016 · 6 comments

Comments

@miniplus
Copy link

OS?

Mac OS Sierra 10.12.1

Versions.

angular-cli: 1.0.0-beta.20-4
node: 6.9.1
os: darwin x64

Repro steps.

Using SCSS:
Have a component's scss file with a prefix-able property (for instance: display: flex);

  • Running ng serve, the output will have various prefixed CSS properties for display: flex;
  • Running ng serve --prod, the output will only have the actual written display: flex, without any prefixes.
@clydin
Copy link
Member

clydin commented Nov 16, 2016

@filipesilva, So it looks like webpack-merge doesn't handle merging LoaderOptionsPlugin. postcss is configured via the plugin in both the common webpack config and the production config.

@grizzm0
Copy link
Contributor

grizzm0 commented Nov 16, 2016

The conflict here is between my PR #2593 and #2852.

Both creates a new instance of webpack.LoaderOptionsPlugin in the plugins array. A quickfix for now would be to simply move postcss-discard-comments into common and doing that in dev aswell. I placed it in prod only to save CPU cycles while working in dev tho.

I don't think there is any webpack plugin for merging that type of config.

@oriolcp
Copy link

oriolcp commented Dec 2, 2016

I manually patch webpack-build-production.js in order to have autoprefxing on production build. I also had to add some extra params on autoprefixer because I needed to give support to Safari 7:
postcss: [autoprefixer({ browsers: ['> 1%', 'last 2 versions', 'Safari 7'] })].
I suggest to add a new setting on angular-cli.json in order to be able to change it, also we should be able to don't prefix anything if the project requeriments are just for the latest browser versions.

@miniplus
Copy link
Author

miniplus commented Dec 2, 2016

@oriolcp In order to specify browser needs concerning this, you can do all of this using a browserslist file (https://github.com/ai/browserslist).

No need to make any changes in the core this way

@oriolcp
Copy link

oriolcp commented Dec 2, 2016

Thanks a lot I didn't know about browserslist file.

MRHarrison pushed a commit to MRHarrison/angular-cli that referenced this issue Feb 9, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants