Uglify is back. Very ugly, but reliable. Dependable. Supportive. There for you.
First: Sourcemapping
Before, Source mapping was something that only worked for basic server setups. Now it can work for everything.
- I’m talking single standalone html files. It can generate a source map directory to sit beside it.
- I’m talking offline-external-js html files. The tiddlywikicore.js file can be versioned, so you can multiple versions of uglified, sourcemapped core code on your WebDAV server or whatever.
- I’m talking external-js Node.JS servers. Uglify your core code, then only load it once anyway.
It’s also just better. Before it initialized sourcemapping through a startup module, which meant all the startup modules before it weren’t sourcemapped. Dumb. and stupid.
Now it uses a boot library, kinda like sjcl.js. It’s secret and hidden, and works much more magically. Every single module will be sourcemapped now.
Second: Pruning
The feature nobody asked for but everybody wants. Uglify can now strip away unwanted features out of Tiddlywiki while it uglifies. Currently, there are only two pruning rules
- uglify: This rule already existed. It strips uglify down to virtually nothing and removes all uglify configuration files from other plugins. Why? Because after uglify is done, you don’t need any of its junk. It will see itself out.
- server: This one is new. And awesome. Since the dawn of time, Tiddlywiki has shipped with all its Node.JS fluff, like commands and server handlers. Why do we need that in an html file? Why do we need that stuff sent to browsers? We don’t. We never did. Now we don’t have to. Uglify cuts it all away and saves you about 70kb.
But this is just the start, kids. The infrastructure for pruning is complete, and new rules are as simple as writing the filters. Here are some ideas I have if people like this idea.
- Remove sjcl and all encryption. I think maybe 1% of people actually encrypt their tiddlers. Yet every tiddlywiki since the beginning of time has shipped with the entire Stanford Javascript Crypto Library.
- Remove all content for editing tiddlers. This would be useful who use Tiddlywiki as a website for end-users. One that’s complete as-is, and shouldn’t be edited. This could trim a LOT from the core code. You’d still be able to change stuff with actions and messages though.
- Remove importing and saving. Again, if you’re generating your Tiddlywiki to be customer facing, you don’t need this stuff.
- Remove all unused themes, color palettes, tweaks, and controls to change them. Same idea
I could go on and on, but I’d love to hear what people would actually be interested in (if any) before I invest time into this. If you have something super custom you’d like to prune, you’re also able to build your own rules. The documentation goes over this.
Your thoughts?
Flibbles