3

I have made some custom changes to my theme files template, CSS and tpl files. Is there a best practice method of updating the theme besides going line by line and re-inserting my custom changes after uploading the new theme? Is there a better way to approach this in the future?

2
  • 2
    Is your theme a custom one or a sub theme?
    – Camsoft
    Commented Mar 9, 2011 at 22:55
  • 1
    Do you mean updating a theme for Drupal 6 to make it work for Drupal 7?
    – avpaderno
    Commented Mar 26, 2011 at 22:19

3 Answers 3

11

You asked "Is there a better way to approach this in the future?".

An alternative to modifying the theme you're basing things on (which I favour) is subthemeing, with which you extend the existing theme by overriding only the aspects you wish to change. This allows you to upgrade the original theme and retain your code separately.

This approach isn't entirely a free pass against maintenance, though.

  • If a fix is applied to the core theme and you've copied the (previously broken) code to your subtheme, then you'll retain the broken code as an override.
  • If a change is made to the base theme which your subtheme doesn't account for, you'll need to handle that.

So - you will still need to review updates to the core theme, but this approach (for me) makes the most sense, means I'm maintaining the smallest amount of code, and provides a fairly straightforward way to build on the existing themes Drupal offers.

3

If you don't have to, don't do it.

I used to do it when Zen 1.x was in development, I would simply run a Diff tool (Changes App) over the latest Starterkit and my sub-theme, and then where necessary over the original source files and the renamed/modified file.

It is a major hassle to do so and a perfect case on why you should not use a Development module for purposes other than helping test and develop.

Themes, unlike modules, generally don't hold enough of a security risk or must have features when they are updated and therefore there really is no need to update to the latest. If it ain't broke...

0

If you're not interested in reinventing your theme by making it a subtheme of a base theme, you can go step by step through http://drupal.org/update/themes/6/7 to update your theme. It may seem like a lot, but if you work it methodically you should meet with success. It would probably take a few hours to go through all the markup, depending upon your theme's complexity. Updating your css may take more time. That really depends upon how much has changed in the ids and classes you targeted, as some modules and core functions have renamed classes and ids in their D7 ports.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.