File tree Expand file tree Collapse file tree 5 files changed +79
-4
lines changed Expand file tree Collapse file tree 5 files changed +79
-4
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ var fs = require ( 'fs' )
4
+ var path = require ( 'path' )
5
+ var mkdirp = require ( 'mkdirp' )
6
+ var rimraf = require ( 'rimraf' )
7
+
8
+ var program = require ( 'commander' )
9
+ var parser = require ( 'ocss-parser' )
10
+
11
+ program
12
+ . version ( require ( '../package.json' ) . version )
13
+ . usage ( '<input> <output>' )
14
+ . parse ( process . argv )
15
+
16
+ var input = program . args [ 0 ]
17
+ var destination = program . args [ 1 ]
18
+
19
+ var filename = path . basename ( input , '.ocss' )
20
+ var contents = fs . readFileSync ( input , 'utf-8' )
21
+
22
+ var ast = parser . parse ( filename , contents )
23
+ var css = parser . stringify ( ast )
24
+
25
+ rimraf ( destination , function ( ) {
26
+
27
+ mkdirp ( path . dirname ( destination ) , function ( error ) {
28
+ if ( error ) throw error
29
+ fs . writeFileSync ( destination , css )
30
+ console . log ( 'created' , destination )
31
+ } )
32
+
33
+ } )
Original file line number Diff line number Diff line change 1
- node_modules
1
+ node_modules
2
+ npm-debug.log
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " ocss" ,
3
- "version" : " 1. 0.0" ,
3
+ "version" : " 0.0.1 " ,
4
4
"description" : " a CSS preprocessor that restricts you to use best practices" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
- "test" : " tape test/index.js | tap-dot "
7
+ "test" : " .bin/ocss test/src/test.ocss test/dist/test.css "
8
8
},
9
9
"repository" : {
10
10
"type" : " git" ,
30
30
"tape" : " ^2.14.0"
31
31
},
32
32
"dependencies" : {
33
- "ocss-parser" : " ^1.3.2"
33
+ "commander" : " ^2.3.0" ,
34
+ "mkdirp" : " ^0.5.0" ,
35
+ "ocss-parser" : " ^1.3.2" ,
36
+ "rimraf" : " ^2.2.8"
34
37
}
35
38
}
Original file line number Diff line number Diff line change
1
+ .test {
2
+ display : block;
3
+ color : red;
4
+ }
5
+ .test-child {
6
+ color : blue;
7
+ background : transparent;
8
+ }
9
+ .test-child-subchild {
10
+ font-size : 12px ;
11
+ }
12
+ .test-child : hover {
13
+ color : red;
14
+ }
15
+ .test--big {
16
+ font-size : 200% ;
17
+ }
18
+ .test--big .test-child {
19
+ color : red;
20
+ }
Original file line number Diff line number Diff line change
1
+ display: block
2
+ color: red
3
+
4
+ child // comment
5
+ color: blue
6
+ background: transparent
7
+
8
+ :hover
9
+ color: red
10
+
11
+ subchild
12
+ font-size: 12px
13
+ // another comment
14
+ =big
15
+ font-size: 200%
16
+
17
+ child
18
+ color: red
You can’t perform that action at this time.
0 commit comments