Closed london111 closed 11 years ago
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
@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.
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.)
For the themes you could also detect all of them using wildcards.
this was more a discussion, closing it
Are there other themes than the atlantis theme available? Is there any manual which describes how to build my own theme?