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
- Host: GitHub
- URL: https://github.com/steelydylan/extract-classnames
- Owner: steelydylan
- Created: 2018-05-19T15:20:05.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-20T03:22:03.000Z (about 8 years ago)
- Last Synced: 2026-04-04T10:33:38.012Z (2 months ago)
- Topics: cli, node, npm
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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);
});
```