diff options
author | Jade Dominguez <plusjade@gmail.com> | 2012-01-20 23:37:40 -0800 |
---|---|---|
committer | Jade Dominguez <plusjade@gmail.com> | 2012-01-20 23:37:40 -0800 |
commit | 61cdb7a8031d1c99c222c4242e199a31c42dabb8 (patch) | |
tree | 8d90df2af45f3ec8eb1f3e2ee2f0d67d86132dd9 /Rakefile | |
parent | 45b894f0af391c5769355ed63876fd879e82fab4 (diff) |
Themes can define configuration data
Themes can define a 'settings.yml' file which will get injected into the root default.html layout YAML Front Matter which can be accessed through the 'page' variable.
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -35,16 +35,20 @@ end # task :new_post desc "Switch between Jekyll-bootstrap themes." task :switch_theme, :theme do |t, args| theme_path = File.join(CONFIG['themes'], args.theme) + settings_file = File.join(theme_path, "settings.yml") + non_layout_files = ["settings.yml"] abort("rake aborted: '#{CONFIG['themes']}/#{args.theme}' directory not found.") unless FileTest.directory?(theme_path) abort("rake aborted: '#{CONFIG['layouts']}' directory not found.") unless FileTest.directory?(CONFIG['layouts']) Dir.glob("#{theme_path}/*") do |filename| + next if non_layout_files.include?(File.basename(filename).downcase) puts "Generating '#{args.theme}' layout: #{File.basename(filename)}" open(File.join(CONFIG['layouts'], File.basename(filename)), 'w') do |page| if File.basename(filename, ".html").downcase == "default" page.puts "---" + page.puts File.read(settings_file) if File.exist?(settings_file) page.puts "---" page.puts "{% assign theme_asset_path = \"/assets/themes/#{args.theme}\" %}" else |