grunt-bem-revised

bem-tools methods with Grunt

Usage no npm install needed!

<script type="module">
  import gruntBemRevised from 'https://cdn.skypack.dev/grunt-bem-revised';
</script>

README

grunt-bem-revised Build Status

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.

Getting Started

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');

Overview

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

Options

method

Type: String Default value: make

sub

Type: String Default value: undefined

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

targets

Type: String Default value: target's name

Build targets.

options.require

Type: String Default value: bem

Path to require BEM library.

options.root

Type: String Default value: .

Project root (cwd by default).

options.workers

Type: Integer Default value: 10

Run number of workers.

options.force

Type: Boolean Default value: False

Force rebuild.

options.verbosity

Type: String Default value: info

Verbosity level (silly, verbose, info, warn, debug, error).

Usage Example

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

Think better. Stay BEMed!