diff --git a/README.md b/README.md index 1f4f3c63..d467ca4e 100644 --- a/README.md +++ b/README.md @@ -554,10 +554,12 @@ 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/gollum/gollum/blob/master/config.rb) for an example. -## CUSTOM CSS +## CUSTOM CSS/JS The `--css` flag will inject `custom.css` from the root of your git repository into each page. `custom.css` must be commited to git or you will get a 302 redirect to the create page. +The `--js` flag will inject `custom.js` from the root of your git repository into each page. `custom.js` must be commited to git or you will get a 302 redirect to the create page. + ## CONTRIBUTE If you'd like to hack on Gollum, start by forking the repo on GitHub: diff --git a/bin/gollum b/bin/gollum index 61e6ecc0..3f2748bb 100755 --- a/bin/gollum +++ b/bin/gollum @@ -49,6 +49,10 @@ opts = OptionParser.new do |opts| wiki_options[:css] = true end + opts.on("--js", "Inject custom js. Uses custom.js from root repository") do + wiki_options[:js] = 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 50893184..3adf1c79 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -85,6 +85,7 @@ module Precious # above will detect base_path when it's used with map in a config.ru settings.wiki_options.merge!({ :base_path => @base_url }) @css = settings.wiki_options[:css] + @js = settings.wiki_options[:js] end get '/' do diff --git a/lib/gollum/frontend/templates/file_view.mustache b/lib/gollum/frontend/templates/file_view.mustache index 16e9f968..830839fc 100644 --- a/lib/gollum/frontend/templates/file_view.mustache +++ b/lib/gollum/frontend/templates/file_view.mustache @@ -6,6 +6,7 @@ {{#css}}{{/css}} + {{#js}}{{/js}}