Nectar of the Programming Masses

    html2bemdecl-loader

    1.0.5 • Public • Published

    A very simple wrapper for html2bemjson and bemjson-to-decl modules.

    Usage

    Just add a rule to module, like this:

        module: {
           rules: [
               { test: /\.html$/, loader: "html2bemdecl-loader" }
           ]
       }

    Now you dont even need to write bemjson/bemdecl by yourself. For example, this input:

    <div class="b-block1">
      <div class="b-block1__elem1">test</div>
    </div>

    Will result in DECL format:

    [
       {
           block: 'b-block1'
       },
       {
           block: 'b-block1',
           elem: 'elem1'
       }
    ]

    You can use this DECL to convert it to require statements with bemdecl-to-fs-loader. So you may write only HTML, and all resources will be included automatically based on classes of HTML elements.

    The example project is available here. The more information about BEM naming you may find here.

    Keywords

    Install

    npm i html2bemdecl-loader

    DownloadsWeekly Downloads

    2

    Version

    1.0.5

    License

    ISC

    Unpacked Size

    2.2 kB

    Total Files

    4

    Last publish

    Collaborators

    • ortophius