No Code Attached Yet
avatar brianteeman
brianteeman
21 Sep 2025

Something is wrong in our build scripts as it is stripping the copyright and version number from some of our css files.

If you compare bootstrap.min.css in a local checkout with a downloaded package you will see the problem.

This is a serious problem as it puts us in breach of the licence

Image

Thats just an example the same is true for many files. This was first reported in the comments of #45674

avatar brianteeman brianteeman - open - 21 Sep 2025
avatar joomla-cms-bot joomla-cms-bot - change - 21 Sep 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 21 Sep 2025
avatar brianteeman brianteeman - change - 21 Sep 2025
The description was changed
avatar brianteeman brianteeman - edited - 21 Sep 2025
avatar richard67
richard67 - comment - 21 Sep 2025

I would assume we have this issue in all 5.x and 6.x branches. Not sure if we also have it already in 4.4-dev.

I'm almost sure @dgrammatiko can tell us where to look for the issue cause. Should be something which happens only when running build.php but not when doing just composer installand npm ci.

avatar richard67
richard67 - comment - 21 Sep 2025

I think it happens only with the minified versions of the css files.

avatar dgrammatiko
dgrammatiko - comment - 21 Sep 2025

Yes the minifier strips ALL comments

avatar brianteeman
brianteeman - comment - 21 Sep 2025

That needs to be changed then as we MUST not remove the copyright notices!!

avatar richard67
richard67 - comment - 21 Sep 2025

We might be able to add them back to the minified css files after they have been removed by the minifier.

avatar brianteeman
brianteeman - comment - 21 Sep 2025

minified files are generated with copyright headers when you run npm ci so I have no idea why the build script is set to remove them. I cant stress enough how bad it is for Joomla to remove the copyright notices

avatar richard67
richard67 - comment - 21 Sep 2025

Sure we should fix that, but that should not stop my other PR for the dependency updates.

avatar brianteeman
brianteeman - comment - 21 Sep 2025

The contents of the media folder after a checkout and npm and the contents in a zipped release should be identical. They're not, and not just the missing copyright

avatar LadySolveig
LadySolveig - comment - 22 Sep 2025

run_and_check('npm run cssversioning');

This step in the build script seems to make the difference, as the licence information is also removed from the non-minified CSS files.

If you comment out this step, they will remain intact. @dgrammatiko

As already mentioned here, the licence is removed from the minified files beforehand.

Yes the minifier strips ALL comments

avatar dgrammatiko
dgrammatiko - comment - 22 Sep 2025

Oh, that’s different than the minifier this lightningcss plugin (I wrote it) is versioning any url based entries. Unfortunately, lightningcss is the problem here. Maybe roll back to postcss (we have the plugin also there)

avatar brianteeman
brianteeman - comment - 22 Sep 2025

whatever is done PLEASE ensure that we end up with the build script creating identical files as are created locally with npm i

its not just the comments that are wrong but also element ordering

Image
avatar richard67
richard67 - comment - 22 Sep 2025

Sone differences we currently also have between consecutive runs of npm ci or consecutive package buils.

avatar brianteeman
brianteeman - comment - 22 Sep 2025

Sone differences we currently also have between consecutive runs of npm ci or consecutive package buils.

such as?

avatar brianteeman
brianteeman - comment - 22 Sep 2025

The principle of reprodicable builds is that they are always the same

avatar richard67
richard67 - comment - 22 Sep 2025

E.g. ordering of assets in diverse joomla-assets-json files. That seems to depend on the asynchronous processing of npm ci or npm install as such.

Sure it would be extremely helpful to have always the same result.

avatar LadySolveig
LadySolveig - comment - 22 Sep 2025

Oh, that’s different than the minifier this lightningcss plugin (I wrote it) is versioning any url based entries. Unfortunately, lightningcss is the problem here. Maybe roll back to postcss (we have the plugin also there)

@dgrammatiko do you mean only roll back this change #42427, or completely roll back to postcss?

avatar LadySolveig
LadySolveig - comment - 22 Sep 2025

At the moment, I can't think of any reason why we shouldn't just call npm ci instead of `npm install in the build script.

run_and_check('npm install --unsafe-perm');

Is --unsafe-perm still available at all?

avatar Fedik
Fedik - comment - 22 Sep 2025

Why does node build/build.mjs --cssversioning modifies existing css/js file when it just should calculate the hash? tries to insert backdoor? :neckbeard:

I see now, it is looking for embed url()

avatar LadySolveig
LadySolveig - comment - 22 Sep 2025

Why does node build/build.mjs --cssversioning modifies existing css/js file when it just should calculate the hash? tries to insert backdoor? :neckbeard:

I see now, it is looking for embed url()

And I think it also "fixes" our UTF8 issue, that we had.
But this was also before the switch to lightningcss.

avatar richard67
richard67 - comment - 22 Sep 2025

At the moment, I can't think of any reason why we shouldn't just call npm ci instead of `npm install in the build script.

joomla-cms/build/build.php

I think we definitely should change that to npm ci.

Is --unsafe-perm still available at all?

I think we should remove that: npm/cli#2196

avatar richard67
richard67 - comment - 22 Sep 2025

P.S.: I think the reason why we sill have npm install and not npm ci in the build.php is because on older npm versions npm ci was not supported. That was the reason for Joomla 4, and later it was just overlooked. But we are safe to change it now in 5 and 6 as we require suitable node and npm versions.

avatar Fedik
Fedik - comment - 22 Sep 2025

It seems problem happen because css transfrom() running twice (first with build and second with versioning) and get confused with the comments.
For example bootstrap-grid.css stay intact but comments from bootstrap.css are removed (at least in my test).

Maybe if we can integrate versioning (css versioning) in to first run (with build), then it should be okau.
In theory.

avatar LadySolveig
LadySolveig - comment - 22 Sep 2025

Interesting find @Fedik , but in the minified version, we probably won't be able to solve it with Lightningcss so that the lincence comment is not deleted.
At least, I haven't found a way to do so yet.
I think it's then a question of deciding whether to roll back completely to PostCSS or whether it's somehow feasible.

avatar Fedik
Fedik - comment - 22 Sep 2025

The same for minified version.
Lightningcss keep comments like /*! ... */. But seems only when it is at begining of the file (or a line), or something like that, I did not found a good explanation.

avatar richard67
richard67 - comment - 22 Sep 2025

@LadySolveig For changing the npm install to npm ci in the build.php script: Do you want to make a PR as it was your finding?

Not really urgent as it should work like before (if package.json and package-lock.json are in synch, what always should be the case on a clean branch), but nice to have.

But if you don't have the time, I can make a PR.

avatar richard67
richard67 - comment - 22 Sep 2025

The same for minified version. Lightningcss keep comments like /*! ... */. But seems only when it is at begining of the file (or a line), or something like that, I did not found a good explanation.

Yes, lightningcss removes it only when at the beginning of the complete file, see comment here: parcel-bundler/lightningcss#43 (comment)

The problem seems to come from the fact that we add the @charset "UTF-8"; to the top of the file before the initial copyright comment, so with the 2nd run for the versioning that comment is not at the beginning of the file anymore and so is removed.

avatar richard67
richard67 - comment - 22 Sep 2025

P.S.: The @charset "UTF-8"; addition was added with this PR into 4.4-dev and later merged up: #42938

avatar richard67
richard67 - comment - 22 Sep 2025

P.P.S.: Ah, not merged up 1 to 1 into 5, but in 5..1-dev it was made with PR #43207 .

avatar LadySolveig
LadySolveig - comment - 22 Sep 2025

Will create a PR and try to fix both. Thank you all for the teamwork and the reporting.

avatar rdeutz rdeutz - change - 25 Sep 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-09-25 13:58:14
Closed_By rdeutz
avatar rdeutz rdeutz - close - 25 Sep 2025

Add a Comment

Login with GitHub to post a comment