Created
November 30, 2014 00:57
-
-
Save tadatuta/11c9a529df64dd635510 to your computer and use it in GitHub Desktop.
Replace comments with iframes in enb-bem-docs results
This file contains 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
(function(d) { | |
var body = d.body, | |
content = body.childNodes, | |
length = content.length; | |
function replaceComment(node) { | |
if(node.nodeType != 8) return; | |
var src = 'http://localhost:8080/' + node.data.replace(' bem-example: ', '').replace(' ', ''), | |
bundleName = src.split('/').pop(), | |
iframe = d.createElement('iframe'); | |
iframe.src = src + '/' + bundleName + '.html'; | |
body.replaceChild(iframe, node); | |
} | |
for(var i = 0; i < length; i++) { | |
replaceComment(content[i]); | |
} | |
})(document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment