Skip to content
This repository was archived by the owner on Jun 8, 2018. It is now read-only.

pbelyaev/extract-bem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extract BEM NPM Package

Build Status NPM Downloads NPM Version NPM License

This package will help you to get BEM blocks from your HTML.

Only elements with classes like this will apear in an output object:

<div class="block"></div>
<div class="some-block"></div>
<div class="someBlock"></div>

Usage

Install package via npm:

$ npm install extract-bem

Require the package:

var extractBEM = require('extract-bem');

In your script put down these lines of code:

var blocks = extractBEM({
    blade: false, // turn on blade engine parser (this options could help you with Laravel templates)
    directory: './src/html', // the directory where your files (also can be an array)
    extension: 'html', // the extension of your files (also can be an array)
    encoding: 'utf8' // the encoding of your files
});

The output will be an object like this:

{
    "filename-without-extension": ["block", "some-block", "someBlock"],
    "another-file-without-extension": []
}

About

NPM Package that extract bem blocks' names from your HTML.

Resources

License

Stars

Watchers

Forks

Packages

No packages published