An open API service indexing awesome lists of open source software.

https://github.com/steelydylan/extract-classnames

extract css classnames from html
https://github.com/steelydylan/extract-classnames

cli node npm

Last synced: about 2 months ago
JSON representation

extract css classnames from html

Awesome Lists containing this project

README

          

# extract-classnames

Node command line tool where you can extract css from html

input

```htm




Look at me!

```

output

```css
.photo {

}
.photo__img {

}
.photo__caption {

}
.photo__quote {

}
```

## Usage

```sh
npm install extract-classnames
npx excn --src ./test/index.html --dest ./test/index.css
```

global install

```sh
npm install extract-classnames -g
excn --src ./test/index.html --dest ./test/index.css
```

you can also execute the same function with the command `extract-classnames`

```sh
extract-classnames --src ./test/index.html --dest ./test/index.css
```

## API

extract
```js
const excn = require('extract-classnames');
const result = excn.extract(html);
```

extractByFile
```js
const excn = require('extract-classnames');
excn.extractByFile('/path/to/filename').then((css) => {
console.log(css);
});
```