This repository was archived by the owner on Mar 2, 2021. It is now read-only.
File tree 3 files changed +17
-5
lines changed
3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ npm install markoify --save
12
12
# Usage:
13
13
14
14
``` bash
15
- browserify -t markoify --extension=" .marko" main.js -o browser.js
15
+ browserify -g markoify --extension=" .marko" main.js -o browser.js
16
16
```
17
17
18
18
# Example
Original file line number Diff line number Diff line change 23
23
"escodegen" : " ^1.8.0" ,
24
24
"esprima" : " ^3.1.3" ,
25
25
"estraverse" : " ^4.2.0" ,
26
- "raptor-async " : " ^1.1.2 " ,
26
+ "minprops " : " ^1.0.0 " ,
27
27
"through" : " ^2.3.8"
28
28
},
29
29
"devDependencies" : {
30
30
"browserify" : " ^14.0.0" ,
31
31
"chai" : " ^3.5.0" ,
32
- "mocha " : " ^3.2.0 " ,
33
- "view-engine " : " ^1.1.1 "
32
+ "marko " : " ^4.0.0-rc.24 " ,
33
+ "mocha " : " ^3.2.0 "
34
34
},
35
- "license" : " Apache License v2 .0" ,
35
+ "license" : " Apache-2 .0" ,
36
36
"bin" : {},
37
37
"main" : " src/index.js" ,
38
38
"publishConfig" : {
Original file line number Diff line number Diff line change @@ -7,6 +7,14 @@ var estraverse = require('estraverse');
7
7
var parseOpts = { } ;
8
8
var through = require ( 'through' ) ;
9
9
var compiler = require ( 'marko/compiler' ) ;
10
+ var minprops = require ( 'minprops' ) ;
11
+
12
+ var isDevelopment =
13
+ ! process . env . NODE_ENV ||
14
+ process . env . NODE_ENV === 'development' ||
15
+ process . env . NODE_ENV === 'dev' ;
16
+
17
+ var minpropsEnabled = ! isDevelopment ;
10
18
11
19
function transformAST ( file , input , callback ) {
12
20
var ast = esprima . parse ( input , parseOpts ) ;
@@ -65,6 +73,10 @@ module.exports = function transform(file) {
65
73
} else {
66
74
input = compiler . compile ( input , file ) ;
67
75
}
76
+ } else {
77
+ if ( minpropsEnabled ) {
78
+ input = minprops ( input , file ) ;
79
+ }
68
80
}
69
81
70
82
if ( input . indexOf ( '.marko' ) === - 1 ) {
You can’t perform that action at this time.
0 commit comments