diff --git a/README.md b/README.md index ed9248a0..0624123c 100644 --- a/README.md +++ b/README.md @@ -536,6 +536,14 @@ Note that filenames on windows must not contain any of the following characters Gollum optionally takes a `--config file`. See [config.rb](https://github.com/github/gollum/blob/master/config.rb) for an example. +## CUSTOM CSS + +The `--css` flag will inject `custom.css` from the root of your git repository into each page. Here's an example of floating the sidebar to the left. + +```css +#wiki-rightbar { float: left !important; } +``` + ## CONTRIBUTE If you'd like to hack on Gollum, start by forking my repo on GitHub: diff --git a/bin/gollum b/bin/gollum index 3f98a988..2ea1aa17 100755 --- a/bin/gollum +++ b/bin/gollum @@ -45,6 +45,10 @@ opts = OptionParser.new do |opts| options['irb'] = true end + opts.on("--css", "Inject custom css. Uses custom.css from root repository") do + wiki_options[:css] = true + end + opts.on("--page-file-dir [PATH]", "Specify the sub directory for all page files (default: repository root).") do |path| wiki_options[:page_file_dir] = path end diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index eadc19e4..ba68923a 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -238,6 +238,7 @@ module Precious @content = @page.formatted_data @toc_content = wiki.universal_toc ? @page.toc_data : nil @mathjax = wiki.mathjax + @css = wiki.css @editable = false mustache :page end @@ -360,6 +361,7 @@ module Precious @content = page.formatted_data @toc_content = wiki.universal_toc ? @page.toc_data : nil @mathjax = wiki.mathjax + @css = wiki.css mustache :page elsif file = wiki.file(fullpath) content_type file.mime_type diff --git a/lib/gollum/frontend/templates/layout.mustache b/lib/gollum/frontend/templates/layout.mustache index 05efa0a4..7007dc49 100644 --- a/lib/gollum/frontend/templates/layout.mustache +++ b/lib/gollum/frontend/templates/layout.mustache @@ -6,6 +6,7 @@ + {{#css}}{{/css}}