motyl

Opinionated blog-aware static site generator written in Ruby
Log | Files | Refs | README | LICENSE

commit 7579ee7b5c7f61f7499bfd9efb3357f9e03f3ac3
parent 03f18e9f29babcfd06e33bd50d729196c94ef32d
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon,  9 Apr 2018 23:52:27 +0200

Make theme directory customizable

Diffstat:
Mbin/motyl | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/bin/motyl b/bin/motyl @@ -37,17 +37,17 @@ data = { 'categories' => {} } +theme = 'themes/' + data['site']['theme'] + '/' + # Loading templates templates = { - 'categories' => File.read('themes/templates/categories.mustache'), - 'atom' => File.read('themes/templates/atom.mustache'), - 'pages' => File.read('themes/templates/page.mustache'), - 'posts' => File.read('themes/templates/post.mustache') + 'categories' => File.read(theme + 'templates/categories.mustache'), + 'atom' => File.read(theme + 'templates/atom.mustache'), + 'pages' => File.read(theme + 'templates/page.mustache'), + 'posts' => File.read(theme + 'templates/post.mustache') } -class Mustache - self.template_path = 'themes/templates/' -end +Mustache.template_path = theme + 'templates/' def render(directory, templates, data) Dir.foreach(directory) do |file| @@ -118,6 +118,6 @@ end # Copy static assets status('Copying assets and static files') -FileUtils.cp_r('themes/fonts', 'public') -FileUtils.cp_r('themes/styles', 'public') +FileUtils.cp_r(theme + 'fonts', 'public') +FileUtils.cp_r(theme + 'styles', 'public') FileUtils.cp_r(Dir.glob('static/*'), 'public')