0

When you purchase an HTML template, usually everything is mixed in together... html, css, images and js.

An example template may look like this:

account.html category.html contact.html /fonts /img item-detail.html media.html register.html style.css author.html category-tile.html /css /images index.html /js new.html shortcodes.html submit.php

Django has static files and templates in separate folders in most cases. Is there a proper way of going about this?

1 Answer 1

1

I would start by moving all the /fonts, /css, and other static files to my static dir.

Then I'd look at the various html files, try to figure out what common elements are shared, and extract those common elements to a base template that can be imported by the various children (this page gives a nice starting point for approaching template style & inheritance). Hopefully by starting with the base template, I could change the paths to static assets in that file alone, and avoid having to change them in each individual child template, but there's always sed, vim macros, or similar tools.

Then I'd go through all the html files and convert each of them to child templates extending the base template. Presumably this would involve some looping between "edit the base" and "edit the children," possibly with some intermediate or unrelated "base" templates if the theme is complicated enough.

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.