made with requirebin
Created
March 28, 2014 20:46
-
-
Save max-mapper/9842648 to your computer and use it in GitHub Desktop.
requirebin sketch
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
| var insertCSS = require('insert-css') | |
| var domify = require('domify') | |
| var css = ".button { display: inline-block; font-family: Arial; background-color: papayawhip; padding: 10px; border: 1px solid salmon; }" | |
| var html = '<div class="button">BUTTON</div>' | |
| // inserts new <style> tag into the <head> | |
| insertCSS(css) | |
| // append the html elements that domify returns to the <body> | |
| document.body.appendChild(domify(html)) |
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
| require=function e(t,r,o){function n(l,u){if(!r[l]){if(!t[l]){var a="function"==typeof require&&require;if(!u&&a)return a(l,!0);if(i)return i(l,!0);throw Error("Cannot find module '"+l+"'")}var s=r[l]={exports:{}};t[l][0].call(s.exports,function(e){var r=t[l][1][e];return n(r?r:e)},s,s.exports,e,t,r,o)}return r[l].exports}for(var i="function"==typeof require&&require,l=0;o.length>l;l++)n(o[l]);return n}({XxGlWs:[function(e,t){var r={};t.exports=function(e){if(!r[e]){r[e]=!0;var t=document.createElement("style");t.setAttribute("type","text/css"),"textContent"in t?t.textContent=e:t.styleSheet.cssText=e;var o=document.getElementsByTagName("head")[0];o.appendChild(t)}}},{}],"insert-css":[function(e,t){t.exports=e("XxGlWs")},{}]},{},[]),require=function e(t,r,o){function n(l,u){if(!r[l]){if(!t[l]){var a="function"==typeof require&&require;if(!u&&a)return a(l,!0);if(i)return i(l,!0);throw Error("Cannot find module '"+l+"'")}var s=r[l]={exports:{}};t[l][0].call(s.exports,function(e){var r=t[l][1][e];return n(r?r:e)},s,s.exports,e,t,r,o)}return r[l].exports}for(var i="function"==typeof require&&require,l=0;o.length>l;l++)n(o[l]);return n}({cBjDVs:[function(e,t){function r(e){if("string"!=typeof e)throw new TypeError("String expected");var t=/<([\w:]+)/.exec(e);if(!t)return document.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var r=t[1];if("body"==r){var n=document.createElement("html");return n.innerHTML=e,n.removeChild(n.lastChild)}var i=o[r]||o._default,l=i[0],u=i[1],a=i[2],n=document.createElement("div");for(n.innerHTML=u+e+a;l--;)n=n.lastChild;if(n.firstChild==n.lastChild)return n.removeChild(n.firstChild);for(var s=document.createDocumentFragment();n.firstChild;)s.appendChild(n.removeChild(n.firstChild));return s}t.exports=r;var o={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};o.td=o.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],o.option=o.optgroup=[1,'<select multiple="multiple">',"</select>"],o.thead=o.tbody=o.colgroup=o.caption=o.tfoot=[1,"<table>","</table>"],o.text=o.circle=o.ellipse=o.line=o.path=o.polygon=o.polyline=o.rect=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"]},{}],domify:[function(e,t){t.exports=e("cBjDVs")},{}]},{},[]);var insertCSS=require("insert-css"),domify=require("domify"),css=".button { display: inline-block; font-family: Arial; background-color: papayawhip; padding: 10px; border: 1px solid salmon; }",html='<div class="button">BUTTON</div>';insertCSS(css),document.body.appendChild(domify(html)); |
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
| { | |
| "name": "requirebin-sketch", | |
| "version": "1.0.0", | |
| "dependencies": { | |
| "insert-css": "0.1.1", | |
| "domify": "1.2.2" | |
| } | |
| } |
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
| <style type='text/css'>html, body { margin: 0; padding: 0; border: 0; } | |
| body, html { height: 100%; width: 100%; }</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment