bem-tools methods with Grunt
npm install grunt-bem-revisedPlugin for work with bem-tools from Grunt using BEM API.
More info about BEM. More info about API.
Read about API for know about necessary parameters for bem-tools methods.
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
``shell`
npm install grunt-bem-revised --save-dev
One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-bem-revised');
In your project's Gruntfile, add a section named bem to the data object passed into grunt.initConfig().
`js`
grunt.initConfig({
bem: {
options: {
// Global options go here.
},
bem_task: {
// Method options go here.
}
}
})
#### method
Type: Stringmake
Default value:
#### sub
Type: Stringundefined
Default value:
Sub method for api methods. Ex: BEM.decl.merge()
#### targets
Type: Stringtarget's name
Default value:
Build targets.
#### options.require
Type: Stringbem
Default value:
Path to require BEM library.
#### options.root
Type: String.
Default value:
Project root (cwd by default).
#### options.workers
Type: Integer10
Default value:
Run number of workers.
#### options.force
Type: BooleanFalse
Default value:
Force rebuild.
#### options.verbosity
Type: Stringinfo
Default value:
Verbosity level (silly, verbose, info, warn, debug, error).
In this example, custom options are used to do build targets desktop.bundles and touch.bundles. BEM is installed as a local package.
`js``
grunt.initConfig({
bem: {
bundles: {
command: "make",
TARGETS: [ "desktop.bundles", "touch.bundles" ],
verbosity: "warn"
},
// Clean .bem/cache
clean: {
command: "make",
method: "clean",
TARGETS: [ "desktop.bundles", "touch.bundles" ],
},
deps: {
command: "decl",
sub: "merge",
declaration: [ "desktop.bundles/index/index.deps.js",
"touch.bundles/index/index.deps.js" ],
output: "<%= project.dist %>/pages.deps.js"
}
}
})
#### Think better. Stay BEMed!