2009-08-26

afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
[personal profile] afuna2009-08-26 11:51 pm
Entry tags:

Creating patches for new styles and new themes

Here's the process to take an existing theme layer and convert it into patch form (with all the fluff and trimmings to make it work on the customize page, have proper credit, etc).

Adding a theme layer to an existing style



To add a theme layer to an existing style, you need to edit two files:

bin/upgrading/s2layers/$layoutname/themes.s2 (or themes-local.s2)
cgi-bin/LJ/S2Theme/$layoutname.pm (or $layoutname_local.pm)

in detail )

Adding an entirely new style from a theme layer



This entry is purely about generating patches from a layer which is already s2-ified, so I won't cover the conversion from a stylesheet to a theme layer. If you need it, see the tutorial for S2 property conversion, which is thoroughly amazing. :)

Hopefully you won't need to do that yourself (the task is time-consuming, but not very complicated,so it's perfect for when you have plenty of time on your hands, but not much brainpower to spare). Let's just move on past it; I'll assume that either the theme came ready-converted, or that you did the conversion on your own.

So, you'll basically end up editing five files:

bin/upgrading/s2layers.dat
bin/upgrading/s2layers/$layoutname/layout.s2
bin/upgrading/s2layers/$layoutname/themes.s2

cgi-bin/LJ/S2Theme/$layoutname.pm
cgi-bin/LJ/S2Theme.pm

in detail )


Other things: images for layouts go under: htdocs/stc/$layoutname/imagename.png, etc. (under stc so that we can access them as relative urls from stylesheets, though in practice, we've been setting them as absolute URLs in properties by using variables, etc)

And uhh. I guess that's it!

Edit: 10/01: fixed a few errors, clarified a few instructions, courtesy of [personal profile] zvi