I've released theme_generator version 1.3.0. It's shaping up rather nicely, if I say so myself.
The theme support is now completely encapsulated in a plugin -- it was split across a plugin and a component.
Like Typo, it fully supports custom application views, of course. (It is based on the Typo theme system, after all.)
It also supports using liquid templates (if you have the liquid plugin installed). You can also lock down the themes to only allow the rendering of liquid templates.
And it's dead simple to use. Once you have the theme_generator installed, here are the steps to make your application support themes...
Step One: Generate a theme named 'default'
In your command terminal, cd
into your Rails (0.14.3+) application folder and execute:
./script/generate theme default
It spits out the folder structure for a theme named 'default' (it doesn't actually have to be called 'default', call it what you like).
Since it's the first time we've used it for this application, it'll also create the theme_support plugin files for us.
Step Two: Update your ApplicationController
Now we update the ApplicationController
(application.rb
) to tell Rails to use our new theme.
'default'# You may need to modify this, the generator will
# create a layout named 'default' by, uh, default
theme 'default'# Tell Rails to use the theme named default
end
layout
Step Three: There is no step three
Your app is now ready to support themes! You can create whatever theme-specific stylesheets, images, javascripts, layouts, and application views you'd like and Rails will pick them up.
Note: To reference theme-specific content you'll want to use the theme_* helper tags. See the docs for more.
Credit where credit is due...
Of course, this generator and plugin wouldn't be as remotely robust if it wasn't for the excellent work of Tobias, Scott, and the rest of the Typo guys.
Installation
Want it? Just gem it:
sudo gem install theme_generator
Or, if you already have it:
sudo gem update theme_generator
If you are on Windows, you can leave out the sudo
part.
In the near future I'll be posting a tutorial explaining how to implement user and/or application level themes... In the meantime, if you have any suggestions or questions, feel free to send 'em my way.
Even better themes (theme_generator version 1.3.0)
ReplyDelete[http://www.mattmccray.com/archives/2005/11/13/theme-generator-shapes-up/:title=Theme Generator Shapes Up] The theme support is now completely encapsulated in a plugin fully supports custom application views supports using liquid templates and it�.
Great job on this and I'm glad to see you've made it available as a plugin and also added liquid support!
ReplyDeleteso since i am lazy and a non-designer... does there exists pre-made themes. thanks.
ReplyDeletehow can i make the user select his own theme?
ReplyDeleteHi there,
ReplyDeleteYour Theme Generator plugin does not work with Rails 1.2.3 or greater…
A one Rajesh Shetty found a way to fix the problem though. It is described in the following post:
http://www.ruby-forum.com/topic/100163#2..
I’m not sure if you are still working on Theme Generator… but if you happen to come back to it, would you be able to add that fix to the plugin without it breaking backwards compatability?
Anyway, just thought I’d let you know.
Andrew