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

CSS is not minified in prod build with master #1934

Closed
trygveaa opened this issue Apr 4, 2017 · 2 comments
Closed

CSS is not minified in prod build with master #1934

trygveaa opened this issue Apr 4, 2017 · 2 comments
Milestone

Comments

@trygveaa
Copy link
Contributor

trygveaa commented Apr 4, 2017

Can you reproduce the problem with latest npm?

Yes

Description

When I'm building to production with the master version of create-react-app, the css is not minified. With the latest released version (v0.9.5) however, it is being minified.

Expected behavior

The css file under build/static/css/ should be minified.

Actual behavior

It is not minified.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected): Running from master, see below.
  2. node -v: v7.7.3
  3. npm -v: 4.4.4

Then, specify:

  1. Operating system: Arch Linux
  2. Browser and version: Irrelevant

Reproducible Demo

I can reproduce this by running these commands:

git clone git@github.com:facebookincubator/create-react-app.git .
npm i
npm run create-react-app test-css-minify
cd test-css-minify
npm run build

And looking at the css file that is built under build/static/css/.

@gaearon gaearon added this to the 0.10.0 milestone Apr 4, 2017
@viankakrisna
Copy link
Contributor

@shaunwallace
Copy link
Contributor

looks as though minimize is set to true for the HtmlWebpackPlugin which uses the html-minifier internally but from the docs it seems as this only handles minification of css in style elements and style attributes. See the screenshots attached. In-order to minify the external css the css-loader option would need to be set to true as follows:

{ loader: 'css-loader', options: { importLoaders: 1, minimize: true, }, }

but the above uses cssnano and I am not sure that by setting this boolean to true, which options would be wanted.

screen shot 2017-04-20 at 20 50 59

screen shot 2017-04-20 at 21 00 28

viankakrisna added a commit to viankakrisna/create-react-app that referenced this issue Apr 21, 2017
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants