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

Allow async functions for minifyCSS and minifyJS #49

Closed
abdonrd opened this issue Sep 11, 2020 · 12 comments
Closed

Allow async functions for minifyCSS and minifyJS #49

abdonrd opened this issue Sep 11, 2020 · 12 comments

Comments

@abdonrd
Copy link

abdonrd commented Sep 11, 2020

Right now we can't use async functions for minifyCSS and minifyJS.

@DanielRuf
Copy link
Contributor

I'm not sure I fully understand what you mean. Can you explain in detail what you mean?

@DanielRuf
Copy link
Contributor

Right, this is why we have to change and adapt code and properly test this.
But I have not much time at the moment for working on this opensource project and more important things to work on.

PRs are very welcome.
But afaik @evilebottnawi wanted to create a fork and push this forward (the migration to Terser 5).

@DanielRuf
Copy link
Contributor

Not sure if we should use one of these or adjust the current code as needed.

@abdonrd
Copy link
Author

abdonrd commented Sep 14, 2020

@evilebottnawi where do you have a fork with the migration? Thanks in advance!

@alexander-akait
Copy link
Collaborator

alexander-akait commented Sep 14, 2020

@abdonrd no right now, we want to start implementation html-minimizer-webpack-plugin at the end of month, that's when i wanted to start creating fork

@slorber
Copy link

slorber commented Oct 12, 2020

Hi,

We use this lib in Docusaurus (the doc site powering... Terser doc 🤪 ) and are affected by a weird bug where this lib tries to use Terser 5, only in yarn monorepo setups where another package use some other terser version (facebook/docusaurus#3515 (comment)).

(undefined) TypeError: Cannot read property 'replace' of undefined
    at Object.options.minifyJS (main:18614:28)
    at Object.chars (main:19102:24)
    at main:48074:19
    at String.replace (<anonymous>)
    at new HTMLParser (main:48066:19)
    at minify (main:18888:3)
    at module.exports.exports.minify (main:19249:16)
    at serverEntry_render (main:87667:38)

Probably not the fault of this lib (maybe a weird Yarn hoisting bug), but we'd appreciate the ability to use Terser v5 and ensure there's an await Terser.minify() to properly read the v5 promise, as that would probably solve our weird Yarn workspace issue + also allow to move to using only Terser v5 instead of a mix of v4 + v5.

Unfortunately can't dedicate time to help on this migration, but willing to be an early adopter as soon as there's a Terser v5 release :)

@DanielRuf
Copy link
Contributor

html-minifier-terser v6.0.0 has been released now: https://www.npmjs.com/package/html-minifier-terser

If someone wants to help with the changelog, that would be great.

https://github.com/terser/html-minifier-terser/releases/tag/v6.0.0

@slorber
Copy link

slorber commented Sep 30, 2021

shouldn't this issue be closed?

@chrisspiegl
Copy link

I just tried implementing CSS minification with remote importing of @import statements.

I found this issue and thought that minifyCSS should support async opperations.

But then also found that it does not?

The minifyJS does implement async?

options.minifyJS = async function (text, inline) {

The minifyCSS does not?

options.minifyCSS = function (text, type) {

Am I missing something? Would this be a new issue to be opened?

@sibiraj-s
Copy link
Collaborator

Hi. Async function for minify-css is not implemented. clean-css is synchronous. A new issue can be opened to track async support for minify css.

@chrisspiegl
Copy link

chrisspiegl commented Feb 15, 2022

@sibiraj-s I created a new issue since it would be useful for the functionality of importing remote @import css statements: #112

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants