Hey all, this week has been both tricky and fairly productive.
I wrote a JS event bus that supports history (specifically undo and redo), which will serve as the foundation for most UI events.
While working out the saving algorithm, I found myself stuck with the choice between having the theme load its style.css file and an additional edits.css file (generated by the editor), or load only a compiled style-and-edits.css file. There are downsides to each method—for the former, it’s impossible to remove a property from a selector; for the latter, the style-and-edits.css file must be recompiled every time the theme’s style.css is updated. After talking with Beau and Andrew, I decided to go with the latter. In the future, I’ll attempt to automate as many recompilations as possible (hook in when a theme is updated through the admin UI, checking the theme’s current version against the version used during the last compilation, and hopefully taking advantage of any APIs Andrew develops to detect file updates), but for now there will likely just be a big “recompile” button.
In switching to the style-and-edits.css method, I found that I needed to tweak the data I was sending from the PHP to the JS. In doing so, I managed to improve performance and slash data size in half. I’m in the process of adapting the JS to the updated data and writing the methods that will power most of the style panels (I posted the first major patch earlier today).
I’m moving along at a brisk pace, but there’s much to be done. And so it goes.