semantic-blocks

0.0.3 • Public • Published

semantic-blocks

NPM version Build status devDependency status

Easily add Schema.org to your BEM-project.

Install

Just install it as npm package:

npm install bh

Add level node_modules/semantic-blocks/schema to your BEM/ENB make file, and add i-bem__schema to deps:

({
    mustDeps: {
        block: 'i-bem',
        elem: 'schema'
    }
});

Usage

itemtype

Add any available schema to any block or element:

bh.match('my-blog__post', function(ctx) {
    ctx.itemtype('Article');
});

yields

<div class="my-blog__post" itemscope itemtype="http://schema.org/Article"></div>

itemprop

Add any itemprop available for your scheme to any block or element:

bh.match('quote__author', function(ctx) {
    ctx.itemprop('author');
});

yields

<div class="quote__author" itemprop="author"></div>

Predefined blocks

Now there is only one block which has schema.org properties: article. So, if you call your block article, it will get an itemtype= http://schema.org/Article.

Other blocks are comming soon. Send me pull-request with blocks you need, or open an issue.

Package Sidebar

Install

npm i semantic-blocks

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • isquariel