flibbles / tw5-uglify

Compress TiddlyWiki5 javascript and plugins
Other
18 stars 2 forks source link

Uglify modifies $:/boot/boot.css diregarding setting #10

Closed Hanl0n closed 1 year ago

Hanl0n commented 1 year ago
  1. I modified $:/boot/boot.css to change the password entry dialogue.
  2. Go to https://flibbles.github.io/tw5-uglify/uglified.html
  3. Drag the TiddlyWiki in the browser / the wizard
  4. Click Confirm
  5. Click Customize
  6. uncheck text/css
  7. $:/boot/boot.css disappearse from the list of compressed Tidlers.
  8. Click Compress TiddlyWiki file

The uglified.html has a changed $:/boot/boot.css and the password entry dialogue looks "normal". After a re-import it works, but it is unexpected.

flibbles commented 1 year ago

Hmm. I'm seeing this too. I'll look back into it when I get a chance. Not sure what changed, but I was sure this worked once long ago.

flibbles commented 1 year ago

The issue was that my project compiler was uglifying boot.css before giving it to the wizard, so it didn't matter whether the wizard compressed it or not. This problem is now fixed.

HOWEVER, the Uglify wizard is still going to clobber whatever changes you put into boot.css. This is because you're dragging a wiki onto it which doesn't have a later core version than it, so it just uses its own when it gives your file back to you. And that cannot be fixed. There is no way to safely look at the system boot files and determine when to use the one it has, or the incoming one. That's part of why the wizard automatically updates your core version. It has to make sure that your boot system files match up with your core version, and it can only do that by giving you fresh copies.

That's why I'm actually recommending that you don't modify boot/boot.css, because even if I could find a way to accommodate manual changes to the system boot files, you'll still run into problems whenever you try to update TiddlyWiki, such as with the official updater wizard. (Also, modifying boot files can be irrecoverably dangerous. Not as much with css files, but still.)

Instead, I recommend you put your css into another tiddler that has the $:/tags/Stylesheet tag. You can add to the existing boot css that way, and if you need to override any existing css directives, you can use the !important keyword to make sure your css takes precedence. I know some people might say using that is bad stylesheet design, but the !important keyword was added exactly for this sort of situation.

(Also, by using your own tiddler to add css, you can see the updates whenever you save the tiddler, instead of having to refresh the page, which I think you're having to do with boot.css)