bem-tools
bem-tools
is a CLI runner for its plugins.
Plugins are npm
packages exporting COA command. By convention they should be named with bem-tools-
prefix so bem-tools
may find them among other packages.
Plugins
Each plugin provides JS API and exports COA command via cli.js
file to be used with bem-tools
.
Available plugins list
bem-tools-create — creates blocks, elements and modifiers on file system according to FS scheme.
bem-tools-find — finds BEM entities on FS according to bem-config settings.
bem-tools-make — at the moment it's a proxy to ENB make.
List of work-in-progress plugins
bem-tools-init — to create project stub.
bem-tools-cp — to copy BEM entities.
bem-tools-rm — to remove BEM entities.
bem-tools-mv — to rename BEM entities.
bem-tools-hint — wrapper for bemhint.
How to create your own plugin
Plugin should be named with
bem-tools-
prefix.By convention each plugin should be available as JS API (so it may be used without
bem-tools
). You may export plugin functionality fromindex.js
file in the root of your package.Plugin should provide
COA
command viacli.js
file (it ):
module.exports = function() {
this
.title('Title of your plugin').helpful()
.opt()
.name('foo').short('f').long('foo')
.title('Foo')
.end()
.arg()
.name('bar').title('Bar')
.arr()
.end()
.act(function(opts, args) {
console.log(opts.foo, args.bar);
})
.end();
};
For more info about COA please refer to https://www.npmjs.com/package/coa.