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

[BUG] Cannot minify CSS #111

Open
jshster opened this issue Apr 4, 2024 · 8 comments
Open

[BUG] Cannot minify CSS #111

jshster opened this issue Apr 4, 2024 · 8 comments

Comments

@jshster
Copy link

jshster commented Apr 4, 2024

Describe the bug
When saving a css file I'm receiving the following error in the output of Netbeans:
file:///C:/Users/*****/.netbeans/minifierbeans/custom-packages/node_modules/@sindresorhus/merge-streams/index.js:60
this.#onFinished ??= onMergedStreamFinished(this, this.#streams);
^^^

SyntaxError: Unexpected token '??='
at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18)

To Reproduce

Steps to reproduce the behavior:

  1. Open css file.
  2. Edit the css file (simply add and delete a space)
  3. Click Save
  4. See error

Expected behavior
Should minify the file

Environment (please complete the following information):

  • OS: Windows 11
  • NetBeans version: 21
  • JDK version 19

Additional context
Interestingly if I right click on the file and select Minify CSS the dialog seems to indicate that the minification has occurred - but it hasn't. Also note that JS minification works without issue.

@Chris2011
Copy link
Owner

@jshster thx for the info, I will have a look into it. So you are trying to minify an empty file, right? I mean it should not make any trouble, but did you try it first with real word css? Also, you have enabled the option "minify on save", right?

If you have a css which breaks, please put it in here too. If it is just an empty file, I will also have a look

@jshster
Copy link
Author

jshster commented Apr 4, 2024

Confirming I was minifying a file with 545 lines on it. I definitely have Minify on Save set - hence why the error occurs when I save the file. Note that I copy and pasted my raw css onto a minify website and it worked perfectly. Just to be sure I just ran the file though the W3C CSS Validator and it parsed successfully, no errors.

@Chris2011
Copy link
Owner

Unfortunately I can't reproduce it. I have now 712 lines of random CSS. I have just classes with some random stuff, no new features etc. Please identify the piece of CSS where this makes problems. I guess there is smth that probably is totally new or that new that it was not implemented into cssnano or smth else. But for now I need more info. Also please check the custom-packages, which version you have.

@Chris2011
Copy link
Owner

And also which version of minifierbeans you have.

@jshster
Copy link
Author

jshster commented May 10, 2024

Hi Chris, my apologies for the delay in responding. I am running Minifier version 3.5.0 with Netbeans 21.
Just to confirm, I am receiving this on every single CSS it tries to minify.

I just create a brand new CSS file that only contains the following:

body, html {
font-size: 100%;
padding: 0;
margin: 0;
font-family: 'PT Sans', sans-serif;
}

When I try to save I get (xxxx has been inserted to protect directory structures):

"C:\Users\xxxx/.netbeans/minifierbeans/custom-packages/postcss.cmd" "--config" "C:\Users\xxxx/.netbeans/minifierbeans/custom-packages" "C:/xxxx/admin/css/test.css" "-o" "C:/xxxxx/admin/css/test.min.css"
file:///C:/Users/xxxx/.netbeans/minifierbeans/custom-packages/node_modules/@sindresorhus/merge-streams/index.js:60
this.#onFinished ??= onMergedStreamFinished(this, this.#streams);
^^^

SyntaxError: Unexpected token '??='
at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18)
Done.

I don't know how to check the version of Custom Packages I have. What should I look for? I thought I installed the same package that came with the latest version of the code but when I download the latest version and only deploy the custom-packages folder I then get a different error which seemed to indicate a mismatch in files or something (sorry didn't copy/paste it).

@Chris2011
Copy link
Owner

Chris2011 commented May 16, 2024

Also please check the custom-packages, which version you have.

And what about this? You need to go to your user folder/.netbeans/minifierbeans/custom-packages/package.json and have a look which one you have. The current working version is: 1.5.2. If not, please remove the folder custom-packages completely.

@jshster
Copy link
Author

jshster commented May 28, 2024

Hey Chris, so.... I checked the package.json and it says version 1.5.1 I then downloaded the latest code and checked the package.json in the code (not the download). All of them have version 1.5.1. When I remove the custom-packages folder and then open Netbeans I then get an endless "Extracting minifierbeans archive" message in the status bar.

Just to be sure here is the package.json that was active:

{
"name": "minifierbeans-custom-packages",
"version": "1.5.1",
"description": "CLIs to minify JS, CSS, HTML and XML.",
"devDependencies": {
"cssnano": "^6.1.0",
"google-closure-compiler": "^20240317.0.0",
"html-minifier-terser": "^7.2.0",
"minify-xml": "^4.4.1",
"postcss": "^8.4.37",
"postcss-cli": "^11.0.0"
},
"dependencies": {
"browserslist": "^4.23.0"
}
}

@Chris2011
Copy link
Owner

I forgot to set the latest version for Minifierbeans to 3.5.1. So please download the latest one. Also I forgot to update the repo custom-packages/package.json to version 1.5.2 which is the latest version, when you download in releases -> custom-packages. So please test it again, it seems everthing is up to date now.

Versions that you need:

  • Minifierbeans 3.5.1
  • custom-packages 1.5.2

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

No branches or pull requests

2 participants