failwyn / BundlerMinifier

Visual Studio extension
Other
43 stars 10 forks source link

Errors on empty css variables (boostrap 5.2) #14

Open it-xtech-dev opened 2 years ago

it-xtech-dev commented 2 years ago

Installed product versions

Description

Empty css variables are treated as not allowed syntax while they are allowed in specs.

Steps to recreate

  1. Download https://github.com/twbs/bootstrap/releases/download/v5.2.2/bootstrap-5.2.2-dist.zip
  2. Try to bundle: css\boostrap.css
  3. Multiple errors "Expected expression, found ';' " will occur

Current behavior

While processing empty value css variable an error is thrown.

Expected behavior

Errors should not be thrown because empty css variables are proper syntax.

Additional information

Issue seems to be fixed with nuglify https://github.com/trullock/NUglify/issues/331

failwyn commented 2 years ago

Thanks for this, I'll get a new version out as soon as I can with NUglify updated; a bit swamped at work at the moment, but I'll get it done.

it-xtech-dev commented 2 years ago

Great! I'm awaiting for new version to check whether problem is solved.

slavenl commented 1 year ago

Thanks for this, I'll get a new version out as soon as I can with NUglify updated; a bit swamped at work at the moment, but I'll get it done.

Hi, can you please do update if it's possible? It's impossible to minify css files and in the case of big files it is really problem.

Thank you!!!

failwyn commented 1 year ago

@slavenl The current version of WebCompiler is using NUglify 1.20.4, so this issue should be resolved; are you getting this exact error? Would you mind uploading a test project that shows the error that you are seeing?

slavenl commented 1 year ago

My setup: VS 2022 17.5.1 Extensions: Web compiler 2022+ (v.1.14.10) Bundler & Minifier 2022+ (v.2.9.3) Bootstrap v5.2.3

If minify{"enabled":false} - build passed OK If minify{"enabled":true} - I got: (Bundler & Minifier) Expected expression, found ';'

Project is too big and specific to send, so I putting screenshots

Extensions setup: image

Error: image

1 line of many errors(12): image

Any suggestion please?

failwyn commented 1 year ago

Apologize, I mistook this issue as a WebCompiler issue; I’ll update NUglify in BundlerMinifier on Monday, test it for the week, and upload a new version on Friday; if you want to help test it, I can upload it here on Monday.

slavenl commented 1 year ago

I'll be glad to assist you in testing, if it's possible. Monday seems great. Thank you for doing this.

slavenl commented 1 year ago

Apologize, I mistook this issue as a WebCompiler issue; I’ll update NUglify in BundlerMinifier on Monday, test it for the week, and upload a new version on Friday; if you want to help test it, I can upload it here on Monday.

Any luck with updating NUglify?

failwyn commented 1 year ago

BundlerMinifierVsix.zip This version uses NUglify 1.20.5 and is arm64 compatible; let me know if you run into any issues, if everything looks good, I'll try to make the official release on Friday.

slavenl commented 1 year ago

Installed successfully as you can see on screenshot

image

But unfortunately error stays persisted as on above screens

image

As it seems, for now, bundler work OK, but minifier can't minify if css key dont have value.

failwyn commented 1 year ago

If you can make a minimal reproduction example, we could submit it to the NUglify repo and see if it can be fixed; When I get some time, I'll try fixing it and submitting a pull request.

Can you set the variable to inherit or some default value as a temporary workaround?

slavenl commented 1 year ago

I created new project and recreated similar setup (with smaller number of css files to bundle) as in my original project and everything passed OK. I'm really confused now. I'll try to find "catch" in next few days and If I manage that, I'll give you info where is the problem.

Maybe it's everything OK with your extension but if you find time please upgrade WebCompiler + Bundler&Minifier in every case because people will need that. It's great component and please keep it alive.

For now, I can go with just bundled files. Thank you.

failwyn commented 1 year ago

Thanks! They are essential extensions for my company, so I’ll keep maintaining them until Visual Studio has good native support. I just get busy at work and don’t have time to be as responsive as I’d like with new versions.

Lewis-Fam commented 1 year ago

Hello. Thanks for managing this extension. I am having the same issues as the OP.

I installed the 2.9.6 build you uploaded. However, now it's throwing an exception.

Here is the error:

\users\daddy\appdata\local\microsoft\visualstudio\17.0_e4e2c58b\extensions\dmp2plwm.0xd\BundlerMinifierConsole.exe "wwwroot/css/site.bundle.min.css" "D:/daddy/dev/.alltdl/src/apps/web/terrelllewis.com/public/bundleconfig.json"
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at BundlerMinifier.BundleHandler.TryGetBundles(String configFile, IEnumerable`1& bundles)
   at BundlerMinifierConsole.Program.GetConfigFileFromArgs(String[] args, String& configPath)
   at BundlerMinifierConsole.Program.Main(String[] args)
Process terminated with code -532462766.
Lewis-Fam commented 1 year ago

@slavenl

Try and bundle bootstrap? I've only had issues when I include bootstrap version 5.2 or 5.3.

5.1 and 5.0 bundle fine.

slavenl commented 1 year ago

@slavenl

Try and bundle bootstrap? I've only had issues when I include bootstrap version 5.2 or 5.3.

5.1 and 5.0 bundle fine.

Issue was born with bootstrap v5.2 because in that version bootstrap embrace emty/null values which seems a problem now. In project we use DevExtreme 22.2.4 which contain Bootstrap 5.2.3. so :)

dserri commented 4 months ago

Hello, is there any news on this topic? I have a project with the latest Bootstrap version and on Rebuild the bundler throws errors. fun fact: if i clean then build it works fine, but with rebuild this error occurs. Any idea why that could happen?

I'm on version 2.9.9, Visual Studio 2022 17.10.3

failwyn commented 4 months ago

I'll try to update bootstrap in my project this week and take a stab at fixing this.

dserri commented 4 months ago

I'll try to update bootstrap in my project this week and take a stab at fixing this.

For better context, the bundler works when:

from Task Runner Explorer: update all files from Build option on solution, even after a clean

Doesn't work when:

from Rebuild on solution

I'm not familiar with vs extensions development, so I'm not sure if there is a difference on the extension on how the minification works based on how it gets called. I'd gladly help but unfortunately I have to leave this up to you to figure out due to lack of competence in this field. I'll follow this thread in case you need any more informations about the issue. Thanks for your work