made with requirebin
Created
March 22, 2014 18:26
-
-
Save deepak1556/9711957 to your computer and use it in GitHub Desktop.
requirebin sketch
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
var parse = require('css-parse'); | |
var css = '/* this is a comment */'; | |
console.log(JSON.stringify(parse(css), null, 2)); |
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
require=function e(r,n,t){function i(u,o){if(!n[u]){if(!r[u]){var a="function"==typeof require&&require;if(!o&&a)return a(u,!0);if(s)return s(u,!0);throw Error("Cannot find module '"+u+"'")}var c=n[u]={exports:{}};r[u][0].call(c.exports,function(n){var e=r[u][1][n];return i(e?e:n)},c,c.exports,e,r,n,t)}return n[u].exports}for(var s="function"==typeof require&&require,u=0;t.length>u;u++)i(t[u]);return i}({lSN2zG:[function(r,n){function e(r){return r?r.replace(/^\s+|\s+$/g,""):""}n.exports=function(r,n){function t(r){var n=r.match(/\n/g);n&&(I+=n.length);var e=r.lastIndexOf("\n");J=~e?r.length-e:J+r.length}function i(){var r={line:I,column:J};return n.position?function(e){return e.position={start:r,end:{line:I,column:J},source:n.source},v(),e}:s}function s(r){return v(),r}function u(e){var t=Error(e+" near line "+I+":"+J);throw t.filename=n.source,t.line=I,t.column=J,t.source=r,t}function o(){return{type:"stylesheet",stylesheet:{rules:f()}}}function a(){return p(/^{\s*/)}function c(){return p(/^}/)}function f(){var n,e=[];for(v(),m(e);"}"!=r.charAt(0)&&(n=O()||C());)e.push(n),m(e);return e}function p(n){var e=n.exec(r);if(e){var i=e[0];return t(i),r=r.slice(i.length),e}}function v(){p(/^\s*/)}function m(r){var n;for(r=r||[];n=l();)r.push(n);return r}function l(){var n=i();if("/"==r.charAt(0)&&"*"==r.charAt(1)){for(var e=2;null!=r.charAt(e)&&("*"!=r.charAt(e)||"/"!=r.charAt(e+1));)++e;e+=2;var s=r.slice(2,e-2);return J+=2,t(s),r=r.slice(e),J+=2,n({type:"comment",comment:s})}}function g(){var r=p(/^([^{]+)/);if(r)return e(r[0]).split(/\s*,\s*/)}function h(){var r=i(),n=p(/^(\*?[-#\/\*\w]+(\[[0-9a-z_-]+\])?)\s*/);if(n){if(n=e(n[0]),!p(/^:\s*/))return u("property missing ':'");var t=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);if(!t)return u("property missing value");var s=r({type:"declaration",property:n,value:e(t[0])});return p(/^[;\s]*/),s}}function d(){var r=[];if(!a())return u("missing '{'");m(r);for(var n;n=h();)r.push(n),m(r);return c()?r:u("missing '}'")}function y(){for(var r,n=[],e=i();r=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)n.push(r[1]),p(/^,\s*/);return n.length?e({type:"keyframe",values:n,declarations:d()}):void 0}function x(){var r=i(),n=p(/^@([-\w]+)?keyframes */);if(n){var e=n[1],n=p(/^([-\w]+)\s*/);if(!n)return u("@keyframes missing name");var t=n[1];if(!a())return u("@keyframes missing '{'");for(var s,o=m();s=y();)o.push(s),o=o.concat(m());return c()?r({type:"keyframes",name:t,vendor:e,keyframes:o}):u("@keyframes missing '}'")}}function k(){var r=i(),n=p(/^@supports *([^{]+)/);if(n){var t=e(n[1]);if(!a())return u("@supports missing '{'");var s=m().concat(f());return c()?r({type:"supports",supports:t,rules:s}):u("@supports missing '}'")}}function q(){var r=i(),n=p(/^@host */);if(n){if(!a())return u("@host missing '{'");var e=m().concat(f());return c()?r({type:"host",rules:e}):u("@host missing '}'")}}function w(){var r=i(),n=p(/^@media *([^{]+)/);if(n){var t=e(n[1]);if(!a())return u("@media missing '{'");var s=m().concat(f());return c()?r({type:"media",media:t,rules:s}):u("@media missing '}'")}}function A(){var r=i(),n=p(/^@page */);if(n){var e=g()||[];if(!a())return u("@page missing '{'");for(var t,s=m();t=h();)s.push(t),s=s.concat(m());return c()?r({type:"page",selectors:e,declarations:s}):u("@page missing '}'")}}function z(){var r=i(),n=p(/^@([-\w]+)?document *([^{]+)/);if(n){var t=e(n[1]),s=e(n[2]);if(!a())return u("@document missing '{'");var o=m().concat(f());return c()?r({type:"document",document:s,vendor:t,rules:o}):u("@document missing '}'")}}function E(){return G("import")}function N(){return G("charset")}function S(){return G("namespace")}function G(r){var n=i(),t=p(RegExp("^@"+r+" *([^;\\n]+);"));if(t){var s={type:r};return s[r]=e(t[1]),n(s)}}function O(){return"@"==r[0]?x()||w()||k()||E()||N()||S()||z()||A()||q():void 0}function C(){var r=i(),n=g();return n?(m(),r({type:"rule",selectors:n,declarations:d()})):void 0}n=n||{};var I=1,J=1;return o()}},{}],"css-parse":[function(r,n){n.exports=r("lSN2zG")},{}]},{},[]);var parse=require("css-parse"),css="/* this is a comment */";console.log(JSON.stringify(parse(css),null,2)); |
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
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"css-parse": "1.7.0" | |
} | |
} |
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
<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