0.1.3 • Published 4 years ago

bem-htmltwig v0.1.3

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
4 years ago

Этот код используетя для перевода bem шаблонов в twig

Инициализация

Для использования парсера нужно его инициализировать.

let template = require("bem-htmltwig"),
    options = {};

template.initialize(options).build();

Декларация модуля

В шаблонах нужно описывать модуль блоком template-config смотреть ниже пример.

module.exports = {
    block: 'page',
    title: 'Title of the page',
    favicon: '/favicon.ico',
    head: [
        { elem: 'meta', attrs: { name: 'description', content: '' } },
        { elem: 'meta', attrs: { name: 'viewport', content: 'width=device-width, initial-scale=1' } },
        { elem: 'css', url: 'index.min.css' }
    ],
    scripts: [{ elem: 'js', url: 'index.min.js' }],
    mods: { theme: 'islands' },
    content: [
        {
            block : 'template-config',
            js : { module : 'favorite', id : '#wrapper', name : 'index.tpl' }
        },
        {
            block : 'content',
            attrs : { id : 'wrapper' },
            content : 'HTML '
        }
    ]
};
0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.9

4 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago