Permalink
Browse files

add readme

  • Loading branch information...
1 parent 2e47c37 commit 7754a16ff6a584acc97b19f25fb568732f8863dd @matthewowen committed Jul 9, 2012
Showing with 48 additions and 0 deletions.
  1. +48 −0 README.markdown
View
@@ -0,0 +1,48 @@
+# Jekyll JSON
+
+Jekyll JSON turns YAML config into JSON, so that you can use it in Javascript.
+
+Passed a YAML key, it'll return a JSON, combining the page specific YAML with any config in _config.yml (using the value set on the page wherever there's a conflict).
+
+## Usage
+
+In _config.yml:
+
+ mapping:
+ provider: google_static
+ api_key: 123456
+ zoom: 10
+ dimensions:
+ width: 600
+ height: 400
+
+In a page's front matter:
+
+ mapping:
+ latitude: 0
+ longitude: 0
+ dimensions:
+ width: 500
+ height: 500
+
+In your layout:
+ <script type="text/javascript">
+ var some_object = {% yaml_to_json mapping %};
+ </script>
+
+Returns
+ <script type="text/javascript">
+ var some_object = {
+ "longitude":0,
+ "api_key":123456,
+ "dimensions":{
+ "height":500,
+ "width":500
+ },
+ "provider":"google_js",
+ "latitude":0,
+ "zoom":10
+ };
+ </script>
+
+

0 comments on commit 7754a16

Please sign in to comment.