grunt-bem-revised

bem-tools methods with Grunt

grunt-bem-revised

Plugin 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:

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:

grunt.loadNpmTasks('grunt-bem-revised');

In your project's Gruntfile, add a section named bem to the data object passed into grunt.initConfig().

grunt.initConfig({
    bem: {
        options: {
            // Global options go here. 
        },
        bem_task: {
            // Method options go here. 
        }
    }
})

Type: String Default value: make

Type: String Default value: undefined

Sub method for api methods. Ex: BEM.decl.merge()

Type: String Default value: target's name

Build targets.

Type: String Default value: bem

Path to require BEM library.

Type: String Default value: .

Project root (cwd by default).

Type: Integer Default value: 10

Run number of workers.

Type: Boolean Default value: False

Force rebuild.

Type: String Default value: info

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.

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"
        }
    }
})

MIT License