]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Specify configBridge as relative path to source 17520/head
authorDavid\ Beitey <david@davidjb.com>
Tue, 8 Sep 2015 04:36:00 +0000 (14:36 +1000)
committerDavid\ Beitey <david@davidjb.com>
Tue, 8 Sep 2015 04:36:00 +0000 (14:36 +1000)
This adjusts the load path for the ``configBridge.json`` file from one
that's relative to the user running the command (eg ``jekyll serve``),
to one that's relative to the ``source`` configuration setting for
Jekyll.

The result is that the user can now have a (customised) ``_config.yml``
for Jekyll anywhere on her filesystem and point to Bootstrap's
``docs`` directory to use as the ``source``.  Previously, in order to
customise it, the original ``_config.yml`` needed to be modified inside
(a forked) Bootstrap, and the ``jekyll`` command could only be run at
the root of the Bootstrap package as the original file path to
``configBridge.json`` was only valid there.

The existing behaviour is not affected.

docs/_plugins/bridge.rb

index 450a6cce3e0c4e1545f8789ea95385a98b63ac4e..a5d30a8f49f137ba1071f40e6c23cff7418c8b1f 100644 (file)
@@ -3,7 +3,8 @@ require 'yaml'
 module Bridge
   class Generator < Jekyll::Generator
     def generate(site)
-      site.data["configBridge"] = YAML.load_file("./grunt/configBridge.json")
+      path = File.join(site.source, "../grunt/configBridge.json")
+      site.data["configBridge"] = YAML.load_file(path)
     end
   end
 end
\ No newline at end of file