Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expandobem

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expandobem

ExpandOBem is a preprocessing step for HTML that allows you to write BEM-style classes in a shorter, more expressive manner.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

ExpandOBem

Travis CI

NPM

ExpandOBem is a preprocessing step for HTML that allows you to write BEM-style classes in a shorter, more expressive manner.

ExpandOBem expands abbreviated BEM-style classes, like so:

<div class='post--featured--recent'></div>

Becomes:

<div class='post post--featured post--recent'></div>

The result is cleaner, more readable source HTML and the speedier switching of modifiers.

Install

npm install expandobem

Usage

CLI

Install globally to use the CLI. ExpandOBem accepts an input file, or can use stdin. It'll either write to a file you specify or pipe to stdout.

expandobem input.html -o 'output.html'

Options
--element, -e   Element syntax
--modifier, -m  Modifier syntax
--outfile, -o   Write the ExpandOBem output to this file.
                If unspecified, ExpandOBem pipes to stdout.
--help, -h      Show help

API

ExpandOBem exposes three methods for processing HTML:

Process File

Read a file and transform it.

expandobem.processFile(path, options)

Process String

Transform a string.

expandobem.processString(string, options)

Process Stream

Transform streaming HTML.

expandobem.processStream(options)

Options

syntax.element (default: __)

The connecting syntax prefixing a block or element.

syntax.modifier (default: --)

The connecting syntax prefixing a modifier.

Test

npm test

Gulp

You can use ExpandOBem directly in a Gulp pipeline using the vinyl-transform plugin and ExpandOBem's processStream function.

var gulp = require('gulp');
var transform = require('vinyl-transform');
var expandobem = require('expandobem');

gulp.src([ '*.html' ])
	.pipe(transform(expandobem.processStream))
	.pipe(gulp.dest('./build'));

License

MIT

Keywords

FAQs

Package last updated on 10 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc