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

Please allow an option to minify js but not css #8985

Closed
4 tasks done
shirotech opened this issue Jul 8, 2022 · 3 comments
Closed
4 tasks done

Please allow an option to minify js but not css #8985

shirotech opened this issue Jul 8, 2022 · 3 comments
Labels
invalid This doesn't seem right

Comments

@shirotech
Copy link

shirotech commented Jul 8, 2022

Description

content = await minifyCSS(content, config)

Looks like part of this code will run in both serve and build mode.

Suggested solution

  • when in serve mode, minifying the CSS can be slow, and hence would be good if there is an option to opt-out of using the config.build.minify flag here, as it doesn't seem to belong in serve mode.
  • if the above is not possible, please allow an option to configure the transform call here:
    const { code, warnings } = await transform(css, {
    it seems most options are hardcoded apart from target.
  • possible introduce a new option called config.build.cssMinify as we have config.build.cssTarget already to keep it consistent, then we can spread it like so in this line:
    const { code, warnings } = await transform(css, {
      loader: 'css',
      minify: true,
      target: config.build.cssTarget || undefined, // probably need to keep this for backwards compatitibility
      ...config.build.cssMinify
    })

Alternative

No response

Additional context

No response

Validations

@sapphi-red
Copy link
Member

sapphi-red commented Jul 8, 2022

Looks like part of this code will run in both serve and build mode.

No, it does not. There is always a return inside this if. So it won't reach that line when serve mode.

if (config.command === 'serve') {

@sapphi-red sapphi-red added invalid This doesn't seem right and removed enhancement: pending triage labels Jul 8, 2022
@shirotech
Copy link
Author

I don't believe it was right to close the issue like that, the feature request still stands, as there are still use cases when someone wants to minify js, but not CSS. Right now it is not possible..

@sapphi-red
Copy link
Member

I thought your reason of this request was performance.
If you want to disable css minification, it is a duplicate of #5619. I would be great if you write the reason why you would like to do that there.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants