Skip to content

themes #63

Closed
london111 opened this Issue Jul 24, 2011 · 5 comments

3 participants

@london111

Are there other themes than the atlantis theme available? Is there any manual which describes how to build my own theme?

@bver
bver commented Aug 21, 2011

I also cannot find a themes documentation, but it seams the atlantis theme can be easily cloned and modified:

cp -r static/themes/atlantis/ static/themes/MYTHEME/

Now MYTHEME's files can be modified.

Then the Rakefile can be extended to compile MYTHEME's scss files to MYTHEME/style.css:

file('static/themes/MYTHEME/style.css' => Dir.glob('static/themes/MYTHEME/*.scss') + Dir.glob('static/themes/lib/*.scss')) do |t|
  puts "Creating #{t.name}..."
  content = "@media screen{#{sass(t.name.gsub('style.css', 'screen.scss'))}}@media print{#{sass(t.name.gsub('style.css', 'print.scss'))}}"
  spew(t.name, content)
end
...
namespace :gen do
...
  desc('Compile CSS files - MYTHEME')
  task :mytheme => %w(static/themes/MYTHEME/style.css
                  plugins/treeview/treeview.css
                  plugins/utils/pygments.css
                  plugins/gallery/gallery.css
                  plugins/misc/fancybox/jquery.fancybox.css
                  plugins/blog/blog.css)

and

rake gen:mytheme

makes the rest.

Do not forget to change config/config.yml line:

# Selected theme
theme: MYTHEME

This is, of course, a quite dirty and non-DRY way but it has worked for me. It is also very sensitive to the later changes of Rakefile.
Warning: do this at your own risk. I guess authors will address the theme creation process in the future.

Pavel

@minad
Owner
minad commented Aug 24, 2011

@bver: This is currently the only way to add a custom theme. I would appreciate if someone finds a better solution which wouldn't require so many modifications.

@bver
bver commented Sep 4, 2011

We can parametrize the rake task I guess:

rake gen:theme theme=MYTHEME

It can be written in the Rakefile using ENV['theme']:

 desc('Compile CSS files - theme=MYTHEME')
 task :theme => ["static/themes/#{ENV['theme']}/style.css",
              "static/themes/#{ENV['theme']}/#{ENV['theme']}.css",                       
              'plugins/treeview/treeview.css',
              'plugins/utils/pygments.css',
              'plugins/gallery/gallery.css',
              'plugins/misc/fancybox/jquery.fancybox.css',
              'plugins/blog/blog.css']

It requires more work, of course -- at least rewriting the file('static/themes/MYTHEME/style.css') command to a more general rule command, some ENV['theme'] sanitization, etc.

A similar approach can be used for cloning (copying default theme files):

rake clone:theme theme=MYTHEME

Rake tasks may improve even translator's life, for instance:

rake clone:locale locale=xy_XY

and

rake gen:locale locale=xy_XY

(The last task can compile some intelligible YAML translations into 09-olelo.unsaved.js and 14-olelo.timeago.js files.)

@minad
Owner
minad commented Sep 4, 2011

For the themes you could also detect all of them using wildcards.

@minad
Owner
minad commented Oct 16, 2012

this was more a discussion, closing it

@minad minad closed this Oct 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.