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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parcel not respecting cssnano config #1721

Closed
vihanb opened this issue Jul 12, 2018 · 3 comments 路 Fixed by #6422
Closed

Parcel not respecting cssnano config #1721

vihanb opened this issue Jul 12, 2018 · 3 comments 路 Fixed by #6422
Labels
馃悰 Bug CSS Preprocessing All the PostCSS, Less, SASS, etc issues Stale Ignore This issue is exempt from getting flagged as stale and autoremoved

Comments

@vihanb
Copy link

vihanb commented Jul 12, 2018

馃悰 bug report

I have my Sass .scss files which are compiled and then I run those through autoprefixer and cssnano. The problem is that when I do this, cssnano transforms expressions like scale(1, 0) to scaleY(0) which causes issues in Safari. So I decided I'll just turn off the reduceTransforms option in cssnano. However even though I have done this, after running Parcel I still get the same CSS with the transformation of scale(1, 0) to scaleY(0) being done.

馃帥 Configuration (.babelrc, package.json, cli command)

My postcss.config.js:

module.exports = {
  plugins: [
    require('autoprefixer'),
    require('cssnano')({
      preset: ['default', {
        reduceTransforms: false
      }]
    })
  ]
};

And to run parcel I am doing this CLI command:

npx parcel build scss/main.scss -d static/css -o main.css

馃 Expected Behavior

As above, I am expecting static/css/main.css to not have this transformation being applied because in my config I have specified reduceTransforms: false

馃槸 Current Behavior

Instead, this transformation is being applied.

馃拋 Possible Solution

I'm not sure why this is happening. Intentionally putting invalid syntax in the postcss.config.js throws a syntax error when running parcel so it is definitely reading the postcss.config.js. Also it does look like autoprefixer is being run correctly so not sure why cssnano wouldn't.

This also doesn't happen when I pass the --no-minify flag but I do want minified output

馃敠 Context

I am statically generating CSS files from SASS which are placed in the server's static files directory so I can serve them. I want to minify the code but this cssnano optimization results in an animation of the transform: property not working in Safari.

馃捇 Code Sample

Source code is this line:

.popover {
    transform: scale(1, 0) rotateX(-90deg);
}

and out I get:

transform: scaleY(0) rotateX(-90deg);

馃實 Your Environment

Software Version(s)
Parcel 1.8.1 (running slightly old version because otherwise babel 7 results in error)
Node v8.9.3
npm/Yarn 6.0.1
Operating System macOS 10.13.4

other versions:

  • cssnano: 4.0.1
@mischnic mischnic added the CSS Preprocessing All the PostCSS, Less, SASS, etc issues label Jun 2, 2019
@gtournie
Copy link

I can't pass any options to cssnano. I tried in postcss.config.js

module.exports = {
  plugins: {
    cssnano: { preset: ['default', { discardComments: { removeAll: true } }] },
  },
}

and in cssnano.config.js

module.exports = {
  preset: ['default', { discardComments: { removeAll: true } }],
}

Parcel 1.12.3
Node 12.8.0
npm 6.10.2
macOs 10.14.5
cssnano 4.1.10

@github-actions github-actions bot added the Stale Inactive issues label Mar 15, 2020
@DeMoorJasper
Copy link
Member

Pretty sure this is still the case

@DeMoorJasper DeMoorJasper added the Stale Ignore This issue is exempt from getting flagged as stale and autoremoved label Mar 15, 2020
@github-actions github-actions bot removed the Stale Inactive issues label Mar 15, 2020
@mateatslc
Copy link

not much of a help but cssnano.config.js works fine for me on Parcel 1.12.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃悰 Bug CSS Preprocessing All the PostCSS, Less, SASS, etc issues Stale Ignore This issue is exempt from getting flagged as stale and autoremoved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants