Dr Nic

Rails themes can remember things

I was getting annoyed at having to remember all the csspath/xpath expressions for a theme I reused in a new project.

So, install_theme now helps each theme folder remember the previously used settings.

gem install install_theme  # version 0.7.0+
install_theme path/to/rails_app path/to/template #content_box \
      --partial "header:#header h2" \
      --partial sidebar:#sidebar"

Now, the next time you apply that same theme to another project you don’t need to mention “#content_box” or use the --partial flags:

install_theme path/to/another_rails_app path/to/template

How?

If you squint your eyes just right, you’ll notice that your original template folder now has an install_theme.yml file. It contains your original settings. You can imagine for yourself how the rest of the “themes can remember things” magic might work.

Templates “For Ruby on Rails”

If you are a template maker, you can now easily make your HTML template “For Ruby on Rails” by including an install_theme.yml file. Think of the children.

Major change

I changed the order of the first two arguments. In future, the path/to/template will be optional. Why? Imagine if each theme you ever used was cached in ~/.install_theme/themes and you could select a theme from a list or by --theme theme_name. That seems neat.

Related posts:

  1. Instant new Rails applications with the App Scrolls When I start a new project I want to start...
  2. Using CoffeeScript in Rails and even on Heroku I’m pretty excited about CoffeeScript as a clean-syntax replacement for...
  3. Dead simple JavaScript Unit Testing in Rails Formats: Video/Screencast (410 Mb, torrent) | Video only (vimeo)...
  4. First look at rails 3.0.pre This article is out of date in some aspects....
  5. Install any HTML theme/template into your Rails app Have you ever even bothered to Google for “rails...

3 Responses to “Rails themes can remember things”

  1. [...] This post was mentioned on Twitter by Ruby Reflector. Ruby Reflector said: Top Ruby Article: Rails themes can remember things: install_theme path/to/another_rails_app pa.. http://bit.ly/4oHzAJ [...]

  2. sergio says:

    Hi Dr Nick

    I am running version 0.8.1 of install_theme with rails 2.3.5 and don’t seem to get it working…

    My app is not themed. The new theme is only available via /original_template.
    Can you shed some light on this.

    Cheers,

    SL

  3. Dr Nic says:

    @sergio – Can you tar/zip up your theme folder and email to me drnicwilliams at gmail.com? Also, raise this issue on the project Issues section so it’s easier to track/follow.