itcsscli 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +11 -1
- data/assets/_syntax.sass +95 -0
- data/assets/itcss.css +1 -0
- data/assets/itcss.js +1 -0
- data/assets/itcss.sass +225 -0
- data/assets/logo_cli.svg +1 -0
- data/assets/logo_doc.svg +1 -0
- data/lib/itcss_doc_parser.rb +150 -0
- data/lib/itcsscli/version.rb +1 -1
- data/lib/itcsscli.rb +26 -16
- data/templates/itcss_config.erb +1 -1
- data/templates/itcss_doc.html.erb +1 -0
- data/templates/itcss_module.erb +2 -3
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34a5dbe3867fba06aaa230bf453c635598f00e52
|
4
|
+
data.tar.gz: 000fd0dd4e094b254cff87f70be368347241e5d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7022b496d62ed3cd9bdb1513f018ef836dd8e12a1112c1f0d4d4af7c2b1881dd6aae65bb0b3a74601e767ffbff57d7a9591a671117aa9f0b1351d5e97cebf9d1
|
7
|
+
data.tar.gz: 6d7c35fb8652941f832c09862dbc70b0e52214cf21dc086c58220a79659872d045de038b729e07c09c9502dad4bf43890892a8338a63d778ee303af9fd410400
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -25,7 +25,7 @@ First, you'll need to set up ITCSS by running:
|
|
25
25
|
```{r, engine='bash'}
|
26
26
|
$ itcss init
|
27
27
|
```
|
28
|
-
|
28
|
+
|
29
29
|
Now go to `itcss.yml` and do your itcss_cli config:
|
30
30
|
|
31
31
|
```yml
|
@@ -148,6 +148,16 @@ If you open the ITCSS's base file now, you'll see that all ITCSS modules are aut
|
|
148
148
|
|
149
149
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/itcss_cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
150
150
|
|
151
|
+
## Development
|
152
|
+
```{r, engine='bash'}
|
153
|
+
$ bundle
|
154
|
+
$ rvm gemset create itcsscli && rvm gemset use itcsscli
|
155
|
+
```
|
156
|
+
|
157
|
+
To compile sass:
|
158
|
+
```
|
159
|
+
$ sass --watch assets/itcss.sass:assets/itcss.css --style compressed --sourcemap=none
|
160
|
+
```
|
151
161
|
|
152
162
|
## License
|
153
163
|
|
data/assets/_syntax.sass
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
code[class*="language-"],
|
2
|
+
pre[class*="language-"]
|
3
|
+
color: black
|
4
|
+
background: none
|
5
|
+
text-shadow: 0 1px white
|
6
|
+
text-align: left
|
7
|
+
white-space: pre
|
8
|
+
word-spacing: normal
|
9
|
+
word-break: normal
|
10
|
+
word-wrap: normal
|
11
|
+
line-height: 1.5
|
12
|
+
|
13
|
+
-moz-tab-size: 4
|
14
|
+
-o-tab-size: 4
|
15
|
+
tab-size: 4
|
16
|
+
|
17
|
+
-webkit-hyphens: none
|
18
|
+
-moz-hyphens: none
|
19
|
+
-ms-hyphens: none
|
20
|
+
hyphens: none
|
21
|
+
|
22
|
+
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
|
23
|
+
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection
|
24
|
+
text-shadow: none
|
25
|
+
background: #b3d4fc
|
26
|
+
|
27
|
+
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
|
28
|
+
code[class*="language-"]::selection, code[class*="language-"] ::selection
|
29
|
+
text-shadow: none
|
30
|
+
background: #b3d4fc
|
31
|
+
|
32
|
+
@media print
|
33
|
+
code[class*="language-"],
|
34
|
+
pre[class*="language-"]
|
35
|
+
text-shadow: none
|
36
|
+
|
37
|
+
.token.comment,
|
38
|
+
.token.prolog,
|
39
|
+
.token.doctype,
|
40
|
+
.token.cdata
|
41
|
+
color: slategray
|
42
|
+
|
43
|
+
.token.punctuation
|
44
|
+
color: #999
|
45
|
+
|
46
|
+
.namespace
|
47
|
+
opacity: .7
|
48
|
+
|
49
|
+
.token.property,
|
50
|
+
.token.tag,
|
51
|
+
.token.boolean,
|
52
|
+
.token.number,
|
53
|
+
.token.constant,
|
54
|
+
.token.symbol,
|
55
|
+
.token.deleted
|
56
|
+
color: #6F6F6F
|
57
|
+
|
58
|
+
.token.selector,
|
59
|
+
.token.attr-name,
|
60
|
+
.token.string,
|
61
|
+
.token.char,
|
62
|
+
.token.builtin,
|
63
|
+
.token.inserted
|
64
|
+
color: #690
|
65
|
+
|
66
|
+
.token.operator,
|
67
|
+
.token.entity,
|
68
|
+
.token.url,
|
69
|
+
.language-css .token.string,
|
70
|
+
.style .token.string
|
71
|
+
color: #a67f59
|
72
|
+
background: hsla(0, 0%, 100%, .5)
|
73
|
+
|
74
|
+
.token.atrule,
|
75
|
+
.token.attr-value,
|
76
|
+
.token.keyword
|
77
|
+
color: #07a
|
78
|
+
|
79
|
+
.token.function
|
80
|
+
color: #DD4A68
|
81
|
+
|
82
|
+
.token.regex,
|
83
|
+
.token.important,
|
84
|
+
.token.variable
|
85
|
+
color: #e90
|
86
|
+
|
87
|
+
.token.important,
|
88
|
+
.token.bold
|
89
|
+
font-weight: bold
|
90
|
+
.token.italic
|
91
|
+
font-style: italic
|
92
|
+
|
93
|
+
.token.entity
|
94
|
+
cursor: help
|
95
|
+
|
data/assets/itcss.css
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
code[class*="language-"],pre[class*="language-"]{color:#000;background:none;text-shadow:0 1px #fff;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*="language-"]::-moz-selection,pre[class*="language-"] ::-moz-selection,code[class*="language-"]::-moz-selection,code[class*="language-"] ::-moz-selection{text-shadow:none;background:#b3d4fc}pre[class*="language-"]::selection,pre[class*="language-"] ::selection,code[class*="language-"]::selection,code[class*="language-"] ::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*="language-"],pre[class*="language-"]{text-shadow:none}}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:#708090}.token.punctuation{color:#999}.namespace{opacity:.7}.token.property,.token.tag,.token.boolean,.token.number,.token.constant,.token.symbol,.token.deleted{color:#6F6F6F}.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted{color:#690}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string{color:#a67f59;background:rgba(255,255,255,0.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.function{color:#DD4A68}.token.regex,.token.important,.token.variable{color:#e90}.token.important,.token.bold{font-weight:bold}.token.italic{font-style:italic}.token.entity{cursor:help}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0}a{color:inherit;text-decoration:none}body{font-family:"Roboto Mono",Consolas,Monaco,monospace;font-size:14px;background-color:#E1DFE1}.container{max-width:600px;margin:60px auto;border-radius:2px;transform:translateX(130px);display:flex;flex-direction:column}.sidebar{position:fixed;width:260px;height:100%;top:0;background-color:#232F42;overflow-y:scroll}header{height:48px;background-color:#567FA8;width:100%;top:0;position:absolute}.logo{height:24px;top:12px;position:absolute;left:12px}.sidebar .logo{position:relative}.sidebar .logo .logo__cli{fill:#567FA8}.nav{position:absolute;width:100%;top:48px;bottom:0;padding-bottom:24px;border-top:1px solid rgba(255,255,255,0.1);overflow-y:scroll}.nav__item{display:block;color:#fff;padding:10px 16px;font-weight:100}.nav__link{padding:6px 16px;margin-left:24px;border-left:4px solid #567FA8;transition:border .2s;font-size:12px}.nav__link:hover{border-left:4px solid #fff}.file{padding-top:6px}.file:before{content:attr(id);text-align:right;display:block;color:#6F6F6F;font-weight:lighter}.file+.file{margin-top:20px}.file__content{padding:20px;background-color:#fff;border:1px solid #BCBCBC;box-shadow:0 3px 6px rgba(0,0,0,0.16);overflow-x:scroll}.file__content .blank_slate{font-size:12px;text-align:center;color:#BCBCBC}.file__content pre{font-size:12px}.module{font-size:26px;line-height:18px;padding:18px 0 8px;margin:10px 0;color:#6F6F6F}.module:after{content:"";position:absolute;left:-24px;border-style:solid;border-width:10px 0 10px 17.3px;border-color:transparent transparent transparent #567FA8}h3:after{color:#fff;font-size:9px;padding:2px 4px;border-radius:4px;vertical-align:middle}h3.bl{color:#2196F3}h3.bl:after{content:"block";background-color:#2196F3}h3.el{color:#9C27B0}h3.el:after{content:"element";background-color:#9C27B0}h3.md{color:#E91E63}h3.md:after{content:"modifier";background-color:#E91E63}h3.va{color:#e90}h3.va:after{content:"variable";background-color:#e90}h3.mx{color:#673AB7}h3.mx:after{content:"mixin";background-color:#673AB7}h3.ke{color:#4CAF50}h3.ke:after{content:"keyframes";background-color:#4CAF50}h3.un{color:#795548}h3.un:after{content:"unclassed";background-color:#795548}h3.ps{color:#3F51B5}h3.ps:after{content:"placeholder selector";background-color:#3F51B5}h3.va{font-size:14px;font-weight:400}
|
data/assets/itcss.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e){var t=n.util.type(e);switch(t){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=n.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return n.util.clone(e)})}return e}},languages:{extend:function(e,t){var a=n.util.clone(n.languages[e]);for(var r in t)a[r]=t[r];return a},insertBefore:function(e,t,a,r){r=r||n.languages;var l=r[e];if(2==arguments.length){a=arguments[1];for(var i in a)a.hasOwnProperty(i)&&(l[i]=a[i]);return l}var o={};for(var s in l)if(l.hasOwnProperty(s)){if(s==t)for(var i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);o[s]=l[s]}return n.languages.DFS(n.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,t,a,r){r=r||{};for(var l in e)e.hasOwnProperty(l)&&(t.call(e,l,e[l],a||l),"Object"!==n.util.type(e[l])||r[n.util.objId(e[l])]?"Array"!==n.util.type(e[l])||r[n.util.objId(e[l])]||(r[n.util.objId(e[l])]=!0,n.languages.DFS(e[l],t,l,r)):(r[n.util.objId(e[l])]=!0,n.languages.DFS(e[l],t,null,r)))}},plugins:{},highlightAll:function(e,t){var a={callback:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};n.hooks.run("before-highlightall",a);for(var r,l=a.elements||document.querySelectorAll(a.selector),i=0;r=l[i++];)n.highlightElement(r,e===!0,a.callback)},highlightElement:function(t,a,r){for(var l,i,o=t;o&&!e.test(o.className);)o=o.parentNode;o&&(l=(o.className.match(e)||[,""])[1].toLowerCase(),i=n.languages[l]),t.className=t.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,o=t.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+l);var s=t.textContent,u={element:t,language:l,grammar:i,code:s};if(n.hooks.run("before-sanity-check",u),!u.code||!u.grammar)return n.hooks.run("complete",u),void 0;if(n.hooks.run("before-highlight",u),a&&_self.Worker){var c=new Worker(n.filename);c.onmessage=function(e){u.highlightedCode=e.data,n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},c.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=n.highlight(u.code,u.grammar,u.language),n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(t),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},highlight:function(e,t,r){var l=n.tokenize(e,t);return a.stringify(n.util.encode(l),r)},tokenize:function(e,t){var a=n.Token,r=[e],l=t.rest;if(l){for(var i in l)t[i]=l[i];delete t.rest}e:for(var i in t)if(t.hasOwnProperty(i)&&t[i]){var o=t[i];o="Array"===n.util.type(o)?o:[o];for(var s=0;s<o.length;++s){var u=o[s],c=u.inside,g=!!u.lookbehind,h=!!u.greedy,f=0,d=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var m=r[p];if(r.length>e.length)break e;if(!(m instanceof a)){u.lastIndex=0;var y=u.exec(m),v=1;if(!y&&h&&p!=r.length-1){var b=r[p+1].matchedStr||r[p+1],k=m+b;if(p<r.length-2&&(k+=r[p+2].matchedStr||r[p+2]),u.lastIndex=0,y=u.exec(k),!y)continue;var w=y.index+(g?y[1].length:0);if(w>=m.length)continue;var _=y.index+y[0].length,P=m.length+b.length;if(v=3,P>=_){if(r[p+1].greedy)continue;v=2,k=k.slice(0,P)}m=k}if(y){g&&(f=y[1].length);var w=y.index+f,y=y[0].slice(f),_=w+y.length,S=m.slice(0,w),A=m.slice(_),O=[p,v];S&&O.push(S);var j=new a(i,c?n.tokenize(y,c):y,d,y,h);O.push(j),A&&O.push(A),Array.prototype.splice.apply(r,O)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.matchedStr=a||null,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var l={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}n.hooks.run("wrap",l);var o="";for(var s in l.attributes)o+=(o?" ":"")+s+'="'+(l.attributes[s]||"")+'"';return"<"+l.tag+' class="'+l.classes.join(" ")+'" '+o+">"+l.content+"</"+l.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,l=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,document.addEventListener&&!r.hasAttribute("data-manual")&&("loading"!==document.readyState?requestAnimationFrame(n.highlightAll,0):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\w\W]*?>)[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));!function(e){e.languages.sass=e.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t]+.+)*/m,lookbehind:!0}}),e.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,inside:{atrule:/(?:@[\w-]+|[+=])/m}}}),delete e.languages.sass.atrule;var a=/((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i,t=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|or|not)\b/,{pattern:/(\s+)-(?=\s)/,lookbehind:!0}];e.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,inside:{punctuation:/:/,variable:a,operator:t}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s]+.*)/m,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:a,operator:t,important:e.languages.sass.important}}}),delete e.languages.sass.property,delete e.languages.sass.important,delete e.languages.sass.selector,e.languages.insertBefore("sass","punctuation",{selector:{pattern:/([ \t]*)\S(?:,?[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,?[^,\r\n]+)*)*/,lookbehind:!0}})}(Prism);
|
data/assets/itcss.sass
ADDED
@@ -0,0 +1,225 @@
|
|
1
|
+
@import "_syntax"
|
2
|
+
|
3
|
+
// Colors
|
4
|
+
$color-bg: #E1DFE1
|
5
|
+
$color-blue: #567FA8
|
6
|
+
$color-dark-blue: #232F42
|
7
|
+
$color-gray: #BCBCBC
|
8
|
+
$color-dark-gray: #6F6F6F
|
9
|
+
|
10
|
+
$color-block: #2196F3
|
11
|
+
$color-element: #9C27B0
|
12
|
+
$color-modifier: #E91E63
|
13
|
+
$color-variable: #e90
|
14
|
+
$color-mixin: #673AB7
|
15
|
+
$color-keyframes: #4CAF50
|
16
|
+
$color-unclassed: #795548
|
17
|
+
$color-place-sel: #3F51B5
|
18
|
+
|
19
|
+
// Settings
|
20
|
+
$sidebar-width: 260px
|
21
|
+
$container-width: 600px
|
22
|
+
|
23
|
+
// Font
|
24
|
+
$monospace: "Roboto Mono", Consolas, Monaco, monospace
|
25
|
+
|
26
|
+
// Resets
|
27
|
+
html, body, div, span, applet, object, iframe,
|
28
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
29
|
+
a, abbr, acronym, address, big, cite, code,
|
30
|
+
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
31
|
+
small, strike, strong, sub, sup, tt, var,
|
32
|
+
dl, dt, dd, ol, ul, li,
|
33
|
+
fieldset, form, label, legend,
|
34
|
+
table, caption, tbody, tfoot, thead, tr, th, td
|
35
|
+
margin: 0
|
36
|
+
padding: 0
|
37
|
+
border: 0
|
38
|
+
outline: 0
|
39
|
+
|
40
|
+
a
|
41
|
+
color: inherit
|
42
|
+
text-decoration: none
|
43
|
+
|
44
|
+
// Objects
|
45
|
+
body
|
46
|
+
font-family: $monospace
|
47
|
+
font-size: 14px
|
48
|
+
background-color: $color-bg
|
49
|
+
|
50
|
+
.container
|
51
|
+
max-width: $container-width
|
52
|
+
margin: 60px auto
|
53
|
+
border-radius: 2px
|
54
|
+
transform: translateX($sidebar-width/2)
|
55
|
+
display: flex
|
56
|
+
flex-direction: column
|
57
|
+
|
58
|
+
// Sidebar
|
59
|
+
.sidebar
|
60
|
+
position: fixed
|
61
|
+
width: $sidebar-width
|
62
|
+
height: 100%
|
63
|
+
top: 0
|
64
|
+
background-color: $color-dark-blue
|
65
|
+
overflow-y: scroll
|
66
|
+
|
67
|
+
// Header
|
68
|
+
header
|
69
|
+
height: 48px
|
70
|
+
background-color: $color-blue
|
71
|
+
width: 100%
|
72
|
+
top: 0
|
73
|
+
position: absolute
|
74
|
+
|
75
|
+
// Logo
|
76
|
+
.logo
|
77
|
+
height: 24px
|
78
|
+
top: 12px
|
79
|
+
position: absolute
|
80
|
+
left: 12px
|
81
|
+
|
82
|
+
.sidebar &
|
83
|
+
position: relative
|
84
|
+
|
85
|
+
.logo__cli
|
86
|
+
fill: $color-blue
|
87
|
+
|
88
|
+
// Navigation
|
89
|
+
.nav
|
90
|
+
position: absolute
|
91
|
+
width: 100%
|
92
|
+
top: 48px
|
93
|
+
bottom: 0
|
94
|
+
padding-bottom: 24px
|
95
|
+
border-top: 1px solid rgba(white, .1)
|
96
|
+
overflow-y: scroll
|
97
|
+
|
98
|
+
.nav__item
|
99
|
+
display: block
|
100
|
+
color: white
|
101
|
+
padding: 10px 16px
|
102
|
+
font-weight: 100
|
103
|
+
|
104
|
+
.nav__link
|
105
|
+
padding: 6px 16px
|
106
|
+
margin-left: 24px
|
107
|
+
border-left: 4px solid $color-blue
|
108
|
+
transition: border .2s
|
109
|
+
font-size: 12px
|
110
|
+
|
111
|
+
&:hover
|
112
|
+
border-left: 4px solid white
|
113
|
+
|
114
|
+
// File
|
115
|
+
.file
|
116
|
+
padding-top: 6px
|
117
|
+
|
118
|
+
&:before
|
119
|
+
content: attr(id)
|
120
|
+
text-align: right
|
121
|
+
display: block
|
122
|
+
color: $color-dark-gray
|
123
|
+
font-weight: lighter
|
124
|
+
|
125
|
+
& + &
|
126
|
+
margin-top: 20px
|
127
|
+
|
128
|
+
.file__content
|
129
|
+
padding: 20px
|
130
|
+
background-color: white
|
131
|
+
border: 1px solid $color-gray
|
132
|
+
box-shadow: 0 3px 6px rgba(0,0,0,0.16)
|
133
|
+
overflow-x: scroll
|
134
|
+
|
135
|
+
.blank_slate
|
136
|
+
font-size: 12px
|
137
|
+
text-align: center
|
138
|
+
color: $color-gray
|
139
|
+
|
140
|
+
pre
|
141
|
+
font-size: 12px
|
142
|
+
|
143
|
+
// Module
|
144
|
+
.module
|
145
|
+
font-size: 26px
|
146
|
+
line-height: 18px
|
147
|
+
padding: 18px 0 8px
|
148
|
+
margin: 10px 0
|
149
|
+
color: $color-dark-gray
|
150
|
+
|
151
|
+
&:after
|
152
|
+
content: ''
|
153
|
+
position: absolute
|
154
|
+
left: -24px
|
155
|
+
border-style: solid
|
156
|
+
border-width: 10px 0 10px 17.3px
|
157
|
+
border-color: transparent transparent transparent $color-blue
|
158
|
+
|
159
|
+
// Markup
|
160
|
+
h3:after
|
161
|
+
color: white
|
162
|
+
font-size: 9px
|
163
|
+
padding: 2px 4px
|
164
|
+
border-radius: 4px
|
165
|
+
vertical-align: middle
|
166
|
+
|
167
|
+
h3.bl
|
168
|
+
color: $color-block
|
169
|
+
|
170
|
+
&:after
|
171
|
+
content: 'block'
|
172
|
+
background-color: $color-block
|
173
|
+
|
174
|
+
h3.el
|
175
|
+
color: $color-element
|
176
|
+
|
177
|
+
&:after
|
178
|
+
content: 'element'
|
179
|
+
background-color: $color-element
|
180
|
+
|
181
|
+
h3.md
|
182
|
+
color: $color-modifier
|
183
|
+
|
184
|
+
&:after
|
185
|
+
content: 'modifier'
|
186
|
+
background-color: $color-modifier
|
187
|
+
|
188
|
+
h3.va
|
189
|
+
color: $color-variable
|
190
|
+
|
191
|
+
&:after
|
192
|
+
content: 'variable'
|
193
|
+
background-color: $color-variable
|
194
|
+
|
195
|
+
h3.mx
|
196
|
+
color: $color-mixin
|
197
|
+
|
198
|
+
&:after
|
199
|
+
content: 'mixin'
|
200
|
+
background-color: $color-mixin
|
201
|
+
|
202
|
+
h3.ke
|
203
|
+
color: $color-keyframes
|
204
|
+
|
205
|
+
&:after
|
206
|
+
content: 'keyframes'
|
207
|
+
background-color: $color-keyframes
|
208
|
+
|
209
|
+
h3.un
|
210
|
+
color: $color-unclassed
|
211
|
+
|
212
|
+
&:after
|
213
|
+
content: 'unclassed'
|
214
|
+
background-color: $color-unclassed
|
215
|
+
|
216
|
+
h3.ps
|
217
|
+
color: $color-place-sel
|
218
|
+
|
219
|
+
&:after
|
220
|
+
content: 'placeholder selector'
|
221
|
+
background-color: $color-place-sel
|
222
|
+
|
223
|
+
h3.va
|
224
|
+
font-size: 14px
|
225
|
+
font-weight: 400
|
data/assets/logo_cli.svg
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<svg class="logo" viewBox="0 0 139 21" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path id="a" d="M138.824 31.625V0H0v31.625h138.824z"/></defs><g transform="translate(0 -3)" fill="none" fill-rule="evenodd"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><path class="logo__cli" d="M91.32 17.28c-.073-.29-3.062-.62-3.1-.947-.072-.438 2.08-.875 2.845-1.35.29-.18 2.952-.765 3.025-1.13.037-.4-2.88-.765-2.77-1.166.4-1.968 1.35-3.973 2.88-5.613 1.786-1.896 4.447-3.28 7.946-3.28 3.718 0 6.38 2.113 7.108 5.394l-5.176 2.406c-.364-1.53-1.385-2.26-2.697-2.26-1.166 0-2.114.51-2.843 1.276-.51.583-.91 1.312-1.166 2.077-.145.547 3.318.584 3.318 1.167 0 .22-3.572.984-3.536 1.166.073.51-2.734.948-2.515 1.313.255.4 3.536.73 3.9.947.4.183.84.292 1.313.292 1.312 0 2.405-.693 3.353-1.932l3.973 3.39c-1.713 2.442-4.228 4.046-7.91 4.046-4.046 0-7.035-2.187-7.946-5.796zm20.23.328l-1.567-.947 2.15-1.348 2.662-1.203-2.078-1.167 2.15-8.603h5.87l-2.15 8.603 2.077 1.166s-2.115.8-2.698 1.202c-.11.437-2.005.91-2.114 1.35-.11.4 1.604.764 1.567.946-.037.073-.037.11-.037.11h7.983l-1.35 5.358h-13.85l1.385-5.468zm17.28.037l-2.735-.948 3.317-1.312 3.244-1.167-2.66-1.166 2.15-8.53h5.796l-2.15 8.53 2.66 1.166-3.244 1.167-3.28 1.312 2.697.948-1.35 5.43h-5.795l1.35-5.43z" fill="#232F42" mask="url(#b)"/><path d="M3.09 17.645l-2.733-.948 3.318-1.312 3.244-1.167-2.662-1.166 2.15-8.53h5.796l-2.15 8.53 2.66 1.166-3.244 1.167-3.28 1.312 2.697.948-1.35 5.43H1.744l1.348-5.43zm13.525-.073l-2.15-.948 2.733-1.312 2.66-1.203-2.077-1.167.84-3.318h-5.176l1.75-5.322h16.585l-2.152 5.322h-5.14l-.838 3.318 2.078 1.166-2.697 1.202-2.697 1.312 2.15.948-1.384 5.504h-5.87l1.385-5.504zM32.112 17.28c-.073-.29-3.062-.62-3.1-.947-.07-.438 2.08-.875 2.845-1.35.29-.18 2.952-.765 3.025-1.13.037-.4-2.88-.765-2.77-1.166.4-1.968 1.35-3.973 2.88-5.613 1.786-1.896 4.447-3.28 7.946-3.28 3.718 0 6.38 2.113 7.108 5.394l-5.176 2.406c-.364-1.53-1.385-2.26-2.697-2.26-1.167 0-2.115.51-2.844 1.276-.51.583-.912 1.312-1.167 2.077-.146.547 3.317.584 3.317 1.167 0 .22-3.572.984-3.536 1.166.073.51-2.734.948-2.515 1.313.254.4 3.535.73 3.9.947.4.183.838.292 1.312.292 1.312 0 2.405-.693 3.353-1.932l3.974 3.39c-1.715 2.442-4.23 4.046-7.912 4.046-4.046 0-7.035-2.187-7.946-5.796zM50.232 19.868l1.75-2.296.802-.984.656-.84c1.932 1.715 3.9 2.553 5.65 2.553.73 0 1.24-.29 1.24-.8 0-.365-4.703-.584-5.396-.912-.437-.22.328-.365.62-.583.583-.4.583-.33.948-.693.62-.62 2.55-.73 2.04-1.167-.4-.328-4.738-.692-4.993-1.13-.402-.62-.584-1.385-.584-2.296 0-1.532.583-2.917 1.604-4.01 1.312-1.422 3.39-2.297 5.978-2.297 2.99 0 5.687 1.02 7.51 2.697l-2.844 4.484c-1.276-1.094-3.463-2.37-5.25-2.37-.728 0-1.202.183-1.202.693 0 .547.328.656 2.66 1.567 1.167.474 2.152.948 2.917 1.53.436.33 3.644.694 3.936 1.13.22.33-1.97.913-2.333 1.168-.62.4-2.698.838-2.698 1.35 0 .29 2.844.545 2.844.837-.184 1.275-.694 2.44-1.57 3.39-1.275 1.348-3.352 2.223-6.013 2.223-3.354 0-6.234-1.276-8.275-3.245zm18.773 0l1.75-2.296.802-.984.656-.84c1.932 1.715 3.9 2.553 5.65 2.553.73 0 1.24-.29 1.24-.8 0-.365-4.703-.584-5.396-.912-.437-.22.328-.365.62-.583.583-.4.583-.33.948-.693.62-.62 2.55-.73 2.04-1.167-.4-.328-4.738-.692-4.993-1.13-.4-.62-.583-1.385-.583-2.296 0-1.532.582-2.917 1.603-4.01 1.312-1.422 3.39-2.297 5.978-2.297 2.99 0 5.687 1.02 7.51 2.697l-2.843 4.484c-1.276-1.094-3.463-2.37-5.25-2.37-.728 0-1.202.183-1.202.693 0 .547.328.656 2.66 1.567 1.167.474 2.15.948 2.917 1.53.437.33 3.645.694 3.937 1.13.217.33-1.97.913-2.334 1.168-.62.4-2.698.838-2.698 1.35 0 .29 2.843.545 2.843.837-.18 1.275-.69 2.44-1.566 3.39-1.276 1.348-3.354 2.223-6.015 2.223-3.354 0-6.234-1.276-8.275-3.245z" fill="#FFF" mask="url(#b)"/></g></svg>
|
data/assets/logo_doc.svg
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<svg class="logo" width="154" height="21" viewBox="0 0 154 21" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path id="a" d="M159 26V0H0v26h159z"/></defs><g transform="translate(0 -3)" fill="none" fill-rule="evenodd"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><path class="logo__cli" d="M91.06 17.6l-2.7-.9 3.276-1.332 3.24-1.188-2.664-1.152 2.124-8.532h6.156c3.348 0 5.472.972 6.768 2.376 1.296 1.404 1.872 3.204 1.872 5.436v.72c-.036.396 2.844.792 2.808 1.152-.072.396-2.88 1.008-3.24 1.188-.576.36-3.204.9-3.42 1.332-.144.288 2.664.612 2.484.9-.396.72-.9 1.404-1.476 2.016-2.052 2.232-5.076 3.42-9.072 3.42h-7.524L91.06 17.6zm8.676-7.704h-.972l-.756 3.132 2.628 1.152-3.24 1.188-3.24 1.332 2.7.936h1.008c1.368 0-.036-.324-.036-.936-.036-.432 2.412-.72 2.7-.828.396-.108 1.44-.252 2.052-.504.36-.144 3.312-.756 3.456-1.188.072-.36-2.628-.792-2.772-1.08-.036-.036 0-.108 0-.144 0-1.008-.288-1.656-.72-2.124-.54-.576-1.404-.936-2.808-.936zm31.732 2.592c0 .144 0 .324-.036.468 0 .396 2.808.756 2.736 1.116-.036.396-2.952.792-3.06 1.152-.108.432-3.096.864-3.24 1.26-.144.324 2.592.612 2.448.9-.468.936-1.08 1.764-1.764 2.52-1.728 1.872-4.176 3.06-6.912 3.06-3.96 0-6.912-2.304-7.92-5.58-.072-.288-2.988-.576-3.06-.9-.072-.396 2.736-.828 2.7-1.26 0-.108 1.152-.468 1.26-.504.324-.216 1.584-.36 1.62-.648 0-.36-2.772-.756-2.7-1.116.36-2.088 1.332-3.996 2.736-5.472 1.728-1.872 4.14-3.06 6.912-3.06 4.896 0 8.28 3.492 8.28 8.064zm-8.064 4.932c.396-.216-2.052-.468-1.728-.828.324-.36 3.456-.792 3.672-1.26.18-.396 3.168-.828 3.24-1.26.072-.324-2.736-.684-2.736-1.044 0-1.872-1.044-3.348-3.06-3.348-1.008 0-1.836.432-2.484 1.116-.54.576-.936 1.332-1.188 2.16-.072.36 2.7.756 2.7 1.116-.036.108-.612.18-1.332.432-.252.108-1.224.54-1.44.72-.576.432-2.592.9-2.34 1.26.252.396 3.42.684 3.852.9.396.216.9.324 1.476.324.504 0 .936-.108 1.368-.288zm12.544-.144c-.072-.288-3.024-.612-3.06-.936-.072-.432 2.052-.864 2.808-1.332.288-.18 2.916-.756 2.988-1.116.036-.396-2.844-.756-2.736-1.152.396-1.944 1.332-3.924 2.844-5.544 1.764-1.872 4.392-3.24 7.848-3.24 3.672 0 6.3 2.088 7.02 5.328l-5.112 2.376c-.36-1.512-1.368-2.232-2.664-2.232-1.152 0-2.088.504-2.808 1.26-.504.576-.9 1.296-1.152 2.052-.144.54 3.276.576 3.276 1.152 0 .216-3.528.972-3.492 1.152.072.504-2.7.936-2.484 1.296.252.396 3.492.72 3.852.936.396.18.828.288 1.296.288 1.296 0 2.376-.684 3.312-1.908l3.924 3.348c-1.692 2.412-4.176 3.996-7.812 3.996-3.996 0-6.948-2.16-7.848-5.724z" fill="#232F42" mask="url(#b)"/><path d="M3.09 17.645l-2.733-.948 3.318-1.312 3.244-1.167-2.662-1.166 2.15-8.53h5.796l-2.15 8.53 2.66 1.166-3.244 1.167-3.28 1.312 2.697.948-1.35 5.43H1.744l1.348-5.43zm13.525-.073l-2.15-.948 2.733-1.312 2.66-1.203-2.077-1.167.84-3.318h-5.176l1.75-5.322h16.585l-2.152 5.322h-5.14l-.838 3.318 2.078 1.166-2.697 1.202-2.697 1.312 2.15.948-1.384 5.504h-5.87l1.385-5.504zM32.112 17.28c-.073-.29-3.062-.62-3.1-.947-.07-.438 2.08-.875 2.845-1.35.29-.18 2.952-.765 3.025-1.13.037-.4-2.88-.765-2.77-1.166.4-1.968 1.35-3.973 2.88-5.613 1.786-1.896 4.447-3.28 7.946-3.28 3.718 0 6.38 2.113 7.108 5.394l-5.176 2.406c-.364-1.53-1.385-2.26-2.697-2.26-1.167 0-2.115.51-2.844 1.276-.51.583-.912 1.312-1.167 2.077-.146.547 3.317.584 3.317 1.167 0 .22-3.572.984-3.536 1.166.073.51-2.734.948-2.515 1.313.254.4 3.535.73 3.9.947.4.183.838.292 1.312.292 1.312 0 2.405-.693 3.353-1.932l3.974 3.39c-1.715 2.442-4.23 4.046-7.912 4.046-4.046 0-7.035-2.187-7.946-5.796zM50.232 19.868l1.75-2.296.802-.984.656-.84c1.932 1.715 3.9 2.553 5.65 2.553.73 0 1.24-.29 1.24-.8 0-.365-4.703-.584-5.396-.912-.437-.22.328-.365.62-.583.583-.4.583-.33.948-.693.62-.62 2.55-.73 2.04-1.167-.4-.328-4.738-.692-4.993-1.13-.402-.62-.584-1.385-.584-2.296 0-1.532.583-2.917 1.604-4.01 1.312-1.422 3.39-2.297 5.978-2.297 2.99 0 5.687 1.02 7.51 2.697l-2.844 4.484c-1.276-1.094-3.463-2.37-5.25-2.37-.728 0-1.202.183-1.202.693 0 .547.328.656 2.66 1.567 1.167.474 2.152.948 2.917 1.53.436.33 3.644.694 3.936 1.13.22.33-1.97.913-2.333 1.168-.62.4-2.698.838-2.698 1.35 0 .29 2.844.545 2.844.837-.184 1.275-.694 2.44-1.57 3.39-1.275 1.348-3.352 2.223-6.013 2.223-3.354 0-6.234-1.276-8.275-3.245zm18.773 0l1.75-2.296.802-.984.656-.84c1.932 1.715 3.9 2.553 5.65 2.553.73 0 1.24-.29 1.24-.8 0-.365-4.703-.584-5.396-.912-.437-.22.328-.365.62-.583.583-.4.583-.33.948-.693.62-.62 2.55-.73 2.04-1.167-.4-.328-4.738-.692-4.993-1.13-.4-.62-.583-1.385-.583-2.296 0-1.532.582-2.917 1.603-4.01 1.312-1.422 3.39-2.297 5.978-2.297 2.99 0 5.687 1.02 7.51 2.697l-2.843 4.484c-1.276-1.094-3.463-2.37-5.25-2.37-.728 0-1.202.183-1.202.693 0 .547.328.656 2.66 1.567 1.167.474 2.15.948 2.917 1.53.437.33 3.645.694 3.937 1.13.217.33-1.97.913-2.334 1.168-.62.4-2.698.838-2.698 1.35 0 .29 2.843.545 2.843.837-.18 1.275-.69 2.44-1.566 3.39-1.276 1.348-3.354 2.223-6.015 2.223-3.354 0-6.234-1.276-8.275-3.245z" fill="#FFF" mask="url(#b)"/></g></svg>
|
@@ -0,0 +1,150 @@
|
|
1
|
+
def initialize_doc
|
2
|
+
@ITCSS_MODULES.each do |current_module|
|
3
|
+
itcss_module_files = Dir[ File.join("#{@ITCSS_DIR}/#{current_module}/", '**', '*') ].reject { |p| File.directory? p }
|
4
|
+
if itcss_module_files.kind_of?(Array) && itcss_module_files.any?
|
5
|
+
module_header = construct_module_header current_module
|
6
|
+
@all_files_markup = @all_files_markup.to_s + module_header
|
7
|
+
end
|
8
|
+
itcss_module_files.each do |current_file|
|
9
|
+
map_file current_file
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
construct_navigation
|
14
|
+
write_itcss_map_file @all_files_markup, @nav
|
15
|
+
end
|
16
|
+
|
17
|
+
def map_file file
|
18
|
+
File.open file do |io|
|
19
|
+
get_lines_content io.read
|
20
|
+
end
|
21
|
+
|
22
|
+
selector_indexes = get_selector_indexes @line_type_indexes
|
23
|
+
selector_blocks = get_selector_blocks @lines, selector_indexes
|
24
|
+
file_markup = construct_file_markup selector_blocks, file
|
25
|
+
@all_files_markup = @all_files_markup.to_s + file_markup
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_lines_content content
|
29
|
+
@lines, @line_type_indexes = [], []
|
30
|
+
content.each_line.with_index do |line, index|
|
31
|
+
line_content = get_line_content line
|
32
|
+
(@lines ||= []).push line
|
33
|
+
(@line_type_indexes ||= []).push line_content
|
34
|
+
# puts "#{index}|#{line_content}|#{line}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_line_content line
|
39
|
+
if line.chars.size <= 1
|
40
|
+
"em" # empty
|
41
|
+
elsif line.start_with? '/// '
|
42
|
+
"sc" # super comment
|
43
|
+
elsif line.start_with? '// '
|
44
|
+
"rc" # regular comment
|
45
|
+
elsif line.start_with? ' '
|
46
|
+
"pr" # property
|
47
|
+
else
|
48
|
+
'sl' # selector
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def get_selector_type line
|
53
|
+
if line.start_with? '='
|
54
|
+
"mx" # mixin
|
55
|
+
elsif line.start_with? '$'
|
56
|
+
"va" # variable
|
57
|
+
elsif line.start_with? '@keyframes'
|
58
|
+
"ke" # keyframe
|
59
|
+
elsif line.start_with? '%'
|
60
|
+
"ps" # placeholder selector
|
61
|
+
elsif !line.include? '.'
|
62
|
+
"un" # unclassed
|
63
|
+
elsif line.include? '--'
|
64
|
+
"md" # modifier
|
65
|
+
elsif line.include? '__'
|
66
|
+
"el" # element
|
67
|
+
else
|
68
|
+
"bl" # block
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def get_selector_indexes line_type_indexes
|
73
|
+
line_type_indexes.each_index.select{|x| line_type_indexes[x] == "sl"}
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_selector_blocks lines, selector_indexes
|
77
|
+
@selector_blocks = []
|
78
|
+
selector_indexes.each_with_index do |index, i|
|
79
|
+
(@selector_blocks ||= []).push lines[index..(selector_indexes[i+1] ? selector_indexes[i+1]-1 : lines.size)]
|
80
|
+
end
|
81
|
+
|
82
|
+
@selector_blocks
|
83
|
+
end
|
84
|
+
|
85
|
+
def construct_file_markup selector_blocks, file_name
|
86
|
+
file_markup = "<div class='file' id='#{excerpt_filename file_name}'><div class='file__content'>"
|
87
|
+
if selector_blocks.kind_of?(Array) && selector_blocks.any?
|
88
|
+
selector_blocks.each do |selector_block|
|
89
|
+
selector_type = get_selector_type selector_block.first
|
90
|
+
file_markup += "<h3 class='#{selector_type}'>#{line_break_string selector_block.shift}</h3>"
|
91
|
+
file_markup += "<pre><code class='language-sass'>#{line_break_array selector_block}</code></pre>"
|
92
|
+
end
|
93
|
+
else
|
94
|
+
file_markup += "<div class='blank_slate'>Empty file :/</div>"
|
95
|
+
end
|
96
|
+
file_markup += "</div></div>"
|
97
|
+
|
98
|
+
file_markup
|
99
|
+
end
|
100
|
+
|
101
|
+
def construct_module_header module_name
|
102
|
+
"<div id='#{module_name}' class='module'>#{module_name}</div>"
|
103
|
+
end
|
104
|
+
|
105
|
+
def construct_navigation
|
106
|
+
@nav = '<div class="nav">'
|
107
|
+
@ITCSS_MODULES.each do |current_module|
|
108
|
+
itcss_module_files = Dir[ File.join("#{@ITCSS_DIR}/#{current_module}/", '**', '*') ].reject { |p| File.directory? p }
|
109
|
+
if itcss_module_files.kind_of?(Array) && itcss_module_files.any?
|
110
|
+
@nav += "<a href='##{current_module}' class='nav__item'>#{current_module}</a>"
|
111
|
+
itcss_module_files.each do |current_file|
|
112
|
+
@nav += "<a href='##{excerpt_filename current_file}' class='nav__item nav__link'>#{excerpt_filename(current_file).split('.')[1]}</a>"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
@nav += '</div>'
|
117
|
+
end
|
118
|
+
|
119
|
+
def write_itcss_map_file content, nav
|
120
|
+
File.open @ITCSS_DOC_TEMPLATE do |io|
|
121
|
+
template = ERB.new io.read
|
122
|
+
logo = line_break_removal File.open(relative_file_path('../assets/logo_doc.svg')).read
|
123
|
+
style = line_break_removal File.open(relative_file_path('../assets/itcss.css')).read
|
124
|
+
javascript = line_break_removal File.open(relative_file_path('../assets/itcss.js')).read
|
125
|
+
|
126
|
+
FileUtils.mkdir_p @ITCSS_DOC_DIR
|
127
|
+
File.open @ITCSS_DOC_FILE, "w+" do |out|
|
128
|
+
out.puts template.result binding
|
129
|
+
end
|
130
|
+
|
131
|
+
puts "create #{@ITCSS_DOC_FILE}".green
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# Helper
|
136
|
+
def excerpt_filename file
|
137
|
+
File.basename(file, ".*").sub('_', '')
|
138
|
+
end
|
139
|
+
|
140
|
+
def line_break_array content
|
141
|
+
content.map{ |p| p.sub("\n", ' ') }.join
|
142
|
+
end
|
143
|
+
|
144
|
+
def line_break_string content
|
145
|
+
content.sub "\n", ' '
|
146
|
+
end
|
147
|
+
|
148
|
+
def line_break_removal content
|
149
|
+
content.sub "\n", ''
|
150
|
+
end
|
data/lib/itcsscli/version.rb
CHANGED
data/lib/itcsscli.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "itcsscli/version"
|
2
|
+
require "itcss_doc_parser"
|
2
3
|
require "erb"
|
3
4
|
require 'fileutils'
|
4
5
|
require 'colorize'
|
@@ -12,6 +13,9 @@ module Itcsscli
|
|
12
13
|
@ITCSS_CONFIG_TEMPLATE = relative_file_path "../templates/itcss_config.erb"
|
13
14
|
@ITCSS_MODULE_TEMPLATE = relative_file_path "../templates/itcss_module.erb"
|
14
15
|
@ITCSS_APP_TEMPLATE = relative_file_path "../templates/itcss_application.erb"
|
16
|
+
@ITCSS_DOC_TEMPLATE = relative_file_path "../templates/itcss_doc.html.erb"
|
17
|
+
@ITCSS_DOC_DIR = 'itcssdoc'
|
18
|
+
@ITCSS_DOC_FILE = "#{@ITCSS_DOC_DIR}/index.html"
|
15
19
|
@ITCSS_MODULES = ["requirements", "settings", "tools", "generic", "base", "objects", "components", "trumps"]
|
16
20
|
@ITCSS_FILES = {
|
17
21
|
"requirements" => "Vendor libraries",
|
@@ -24,12 +28,12 @@ module Itcsscli
|
|
24
28
|
"trumps" => "Overrides and helper classes."
|
25
29
|
}
|
26
30
|
|
27
|
-
@ITCSS_COMMANDS = ['init', 'install', 'new', 'n', 'inuit', 'update', 'u', 'help', 'h', '-h', 'version', 'v', '-v']
|
31
|
+
@ITCSS_COMMANDS = ['init', 'install', 'new', 'n', 'inuit', 'update', 'u', 'doc', 'help', 'h', '-h', 'version', 'v', '-v']
|
28
32
|
|
29
33
|
@ITCSS_COMMANDS_DESCRIPTION = [
|
30
34
|
" COMMAND ALIAS FUNCTION ",
|
31
|
-
"itcss init | | Initiates itcsscli configuration with a
|
32
|
-
"itcss install [filenames] | | Creates an example of ITCSS structure in path specified in
|
35
|
+
"itcss init | | Initiates itcsscli configuration with a #{@ITCSS_CONFIG_FILE} file. [start here]",
|
36
|
+
"itcss install [filenames] | | Creates an example of ITCSS structure in path specified in #{@ITCSS_CONFIG_FILE}.",
|
33
37
|
"itcss new [module] [filename] | n | Creates a new ITCSS module and automatically import it into imports file.",
|
34
38
|
"itcss inuit new [inuit module] |inuit n| Add specified inuit module as an itcss dependency.",
|
35
39
|
"itcss inuit help |inuit h| Add specified inuit module as an itcss dependency.",
|
@@ -92,20 +96,21 @@ module Itcsscli
|
|
92
96
|
elsif 'inuit' == ARGV[0]
|
93
97
|
inuit_command_parser
|
94
98
|
|
95
|
-
|
96
99
|
# $ itcss help
|
97
100
|
elsif ['help', '-h', 'h'].include? ARGV[0]
|
98
101
|
itcss_help
|
99
102
|
|
100
|
-
|
101
103
|
# $ itcss version
|
102
104
|
elsif ['version', '-v', 'v'].include? ARGV[0]
|
103
105
|
itcss_version
|
104
|
-
end
|
105
106
|
|
107
|
+
# $ itcss doc
|
108
|
+
elsif 'doc' == ARGV[0]
|
109
|
+
initialize_doc
|
110
|
+
end
|
106
111
|
|
107
112
|
# $ itcss update
|
108
|
-
if ['install', 'new', 'n', '
|
113
|
+
if ['install', 'new', 'n', 'update', 'u'].include? ARGV[0]
|
109
114
|
itcss_init_checker
|
110
115
|
itcss_update_import_file
|
111
116
|
end
|
@@ -113,7 +118,7 @@ module Itcsscli
|
|
113
118
|
|
114
119
|
def itcss_init
|
115
120
|
if File.exist?(@ITCSS_CONFIG_FILE)
|
116
|
-
puts "There is already a
|
121
|
+
puts "There is already a #{@ITCSS_CONFIG_FILE} created.".yellow
|
117
122
|
puts "Do you want to override it? [ y / n ]"
|
118
123
|
user_override_itcss_yml = STDIN.gets.chomp
|
119
124
|
unless user_override_itcss_yml == 'y'
|
@@ -123,7 +128,7 @@ module Itcsscli
|
|
123
128
|
|
124
129
|
init_config = {}
|
125
130
|
|
126
|
-
puts "Well done! Let's configure your
|
131
|
+
puts "Well done! Let's configure your #{@ITCSS_CONFIG_FILE}:".yellow
|
127
132
|
|
128
133
|
puts "Provide the root folder name where the ITCSS file structure should be built:"
|
129
134
|
user_itcss_dir = STDIN.gets.chomp
|
@@ -186,7 +191,6 @@ module Itcsscli
|
|
186
191
|
|
187
192
|
file_path = "#{@ITCSS_DIR}/#{type}/_#{type}.#{file}.sass"
|
188
193
|
unless File.exist?(file_path)
|
189
|
-
contents = "##{type}.#{file}"
|
190
194
|
File.open file_path, "w+" do |out|
|
191
195
|
out.puts template.result binding
|
192
196
|
end
|
@@ -240,7 +244,7 @@ module Itcsscli
|
|
240
244
|
puts "There's no #{@ITCSS_CONFIG_FILE} created yet. Run `itcss init` to create it.".red
|
241
245
|
abort
|
242
246
|
elsif @ITCSS_DIR.nil? || @ITCSS_BASE_FILE.nil?
|
243
|
-
puts "Something is wrong with your
|
247
|
+
puts "Something is wrong with your #{@ITCSS_CONFIG_FILE} file. Please run `itcss init` again to override it.".red
|
244
248
|
abort
|
245
249
|
end
|
246
250
|
end
|
@@ -276,7 +280,7 @@ module Itcsscli
|
|
276
280
|
# INUIT
|
277
281
|
def inuit_command_parser
|
278
282
|
if @ITCSS_PACKAGE_MANAGER.nil?
|
279
|
-
puts "You didn't choose a package manager. Please do it in
|
283
|
+
puts "You didn't choose a package manager. Please do it in #{@ITCSS_CONFIG_FILE}".red
|
280
284
|
abort
|
281
285
|
end
|
282
286
|
|
@@ -294,13 +298,17 @@ module Itcsscli
|
|
294
298
|
elsif ['help', 'h', '-h'].include? ARGV[1]
|
295
299
|
inuit_help
|
296
300
|
end
|
301
|
+
|
302
|
+
# $ itcss update
|
303
|
+
if ['new', 'n'].include? ARGV[1]
|
304
|
+
itcss_update_import_file
|
305
|
+
end
|
297
306
|
end
|
298
307
|
|
299
308
|
def inuit_new_module(c_module, file, module_object)
|
300
309
|
if file
|
301
310
|
current_module_name = inuit_module_fullname(c_module, file)
|
302
|
-
|
303
|
-
current_config = YAML.load_file(config_file)
|
311
|
+
current_config = YAML.load_file(@ITCSS_CONFIG_FILE)
|
304
312
|
|
305
313
|
if current_config['inuit_modules'].nil?
|
306
314
|
current_config['inuit_modules'] = []
|
@@ -324,8 +332,9 @@ module Itcsscli
|
|
324
332
|
end
|
325
333
|
end
|
326
334
|
|
335
|
+
@INUIT_MODULES = current_config['inuit_modules']
|
336
|
+
|
327
337
|
puts "using #{@ITCSS_PACKAGE_MANAGER} to install inuit '#{current_module_name}' dependency...".green
|
328
|
-
sleep(2)
|
329
338
|
output = `#{@ITCSS_PACKAGE_MANAGER} install --save #{module_object['slug']}`
|
330
339
|
puts output
|
331
340
|
|
@@ -360,8 +369,9 @@ module Itcsscli
|
|
360
369
|
end
|
361
370
|
|
362
371
|
def inuit_imports_path(filename)
|
372
|
+
@ITCSS_PACKAGE_MANAGER == 'bower' ? package_manager_prefix = 'bower_components' : package_manager_prefix = 'node_modules'
|
363
373
|
frags = filename.split(".")
|
364
|
-
"inuit-#{frags[1]}/#{filename}"
|
374
|
+
"#{package_manager_prefix}/inuit-#{frags[1]}/#{filename}"
|
365
375
|
end
|
366
376
|
|
367
377
|
end
|
data/templates/itcss_config.erb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>ITCSSDoc</title></script></head><body><style><%= style %></style><script><%= javascript %></script><div class="container"><%= content %></div><div class="sidebar"><%= logo %><%= nav %></div><header><%= logo %></header></body></html>
|
data/templates/itcss_module.erb
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
<%= "//
|
2
|
-
<%= "//
|
3
|
-
<%= "// " + "=" * 40 %>
|
1
|
+
<%= "// @group #{type}" %>
|
2
|
+
<%= "// @name #{file}" %><%= type == "components" ? "\n\n.#{file}" : '' %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itcsscli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kande Bonfim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,15 +66,23 @@ files:
|
|
66
66
|
- LICENSE.txt
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
|
+
- assets/_syntax.sass
|
70
|
+
- assets/itcss.css
|
71
|
+
- assets/itcss.js
|
72
|
+
- assets/itcss.sass
|
73
|
+
- assets/logo_cli.svg
|
74
|
+
- assets/logo_doc.svg
|
69
75
|
- bin/console
|
70
76
|
- bin/itcss
|
71
77
|
- bin/setup
|
72
78
|
- data/inuit_modules.yml
|
73
79
|
- itcsscli.gemspec
|
80
|
+
- lib/itcss_doc_parser.rb
|
74
81
|
- lib/itcsscli.rb
|
75
82
|
- lib/itcsscli/version.rb
|
76
83
|
- templates/itcss_application.erb
|
77
84
|
- templates/itcss_config.erb
|
85
|
+
- templates/itcss_doc.html.erb
|
78
86
|
- templates/itcss_module.erb
|
79
87
|
homepage: https://github.com/kandebonfim/itcsscli
|
80
88
|
licenses:
|
@@ -96,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
104
|
version: '0'
|
97
105
|
requirements: []
|
98
106
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.5.1
|
107
|
+
rubygems_version: 2.4.5.1
|
100
108
|
signing_key:
|
101
109
|
specification_version: 4
|
102
110
|
summary: Manage you CSS with ITCSS from command line.
|