Last active
July 20, 2017 05:58
-
-
Save r-k-b/6617f49ec6922050802471ff229f7e86 to your computer and use it in GitHub Desktop.
A quick way to inspect the contents of the Global Scope in Liquid Markup, using the browser's dev tools.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type='text/javascript' data-source='https://gist.github.com/r-k-b/6617f49ec6922050802471ff229f7e86'> | |
| // # dump-liquid-scope-to-console | |
| // | |
| // A quick way to inspect the contents of the Global Scope in Liquid Markup, using the browser's dev tools. | |
| (function () { | |
| function decodeHtml(html) { | |
| var txt = document.createElement("textarea"); | |
| txt.innerHTML = html; | |
| return txt.value; | |
| } | |
| const globalsRaw = "{{ this | json | escape | replace: '\', '\\' | strip_newlines: '\n' }}"; | |
| window.globals = JSON.parse(decodeHtml(globalsRaw)); | |
| console.info('liquid globals:', globals); | |
| })(); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment