Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/efiand/posthtml-bem-linter
https://github.com/efiand/posthtml-bem-linter
bem-linter npm-package portfolio-project posthtml vanilla-js
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/efiand/posthtml-bem-linter
- Owner: efiand
- Created: 2022-11-24T12:11:06.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-16T18:40:04.000Z (almost 2 years ago)
- Last Synced: 2024-11-11T22:12:02.091Z (about 1 month ago)
- Topics: bem-linter, npm-package, portfolio-project, posthtml, vanilla-js
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/posthtml-bem-linter
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# posthtml-bem-linter[ ![npm version](https://img.shields.io/npm/v/posthtml-bem-linter.svg)](https://www.npmjs.com/package/posthtml-bem-linter)
Pure function and posthtml plugin for linting a bem html. Fork of [gulp-html-bemlinter](https://www.npmjs.com/package/gulp-html-bemlinter).
Additions:
- Support `modifier` option (default value is `--`).
- No flood on success.## Usage
First, install `posthtml-bem-linter` as a development dependency:
```bash
npm i --DE posthtml-bem-linter
```Then, add it to your `posthtml.config.js`:
```js
const { getPosthtmlBemLinter } = require('posthtml-bem-linter');module.exports = {
plugins: [
getPosthtmlBemLinter({
getSourceName: (filename) => filename,
log: console,
modifier: '--'
})
]
};
```(There are default values of optional params `getSourceName`, `log` and `modifier` in this example.)
Or use function `lintBem` in pure Node:
```js
const { lintBem } = require('posthtml-bem-linter');// ...
lintBem({
name,
content,
log: console,
modifier: '--'
});
```(There are default values of optional params `log` and `modifier` in this example.)