-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbem.js
More file actions
executable file
·49 lines (41 loc) · 1.32 KB
/
bem.js
File metadata and controls
executable file
·49 lines (41 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env node
// Modules
//
var commands = require('./bem/bem-commands');
// Command line parser
//
var argv = require('yargs')
.usage('Usage: $0 <object> <path> <name>')
.command('object', 'The BEM object to be created. It can be [level, block, element, modifier] or [l, b, e, m]')
.command('path', 'The parent of the BEM object')
.command('name', 'The name of BEM object to be created inside <path>.')
.example('$0 level components/framework', '=> "components/framework"')
.example('$0 block components/framework header', '=> "components/framework/header/header.html.swig"')
.example('$0 element header logo', '=> "header/__logo/header__logo.html.swig"')
.example('$0 modifier header/__logo hover', '=> "header/__logo/--hover/header__logo--hover.html.swig"')
.example('$0 modifier header black', '=> "header/--black/header--black.html.swig"')
.demand(2)
.argv;
var object = argv._[0];
var path = argv._[1];
var name = argv._[2];
switch (object) {
case 'level':
case 'l':
commands.makeLevel(path);
break;
case 'block':
case 'b':
commands.makeBlock(path, name);
break;
case 'element':
case 'e':
commands.makeElement(path, name);
break;
case 'modifier':
case 'm':
commands.makeModifier(path, name);
break;
default:
console.log('Wrong arguments: ' + object);
}