extract-classnames
v0.0.7
Published
Extract css from html files
Downloads
5
Readme
extract-classnames
Node command line tool where you can extract css from html
input
<figure class="photo">
<img class="photo__img" src="me.jpg">
<figcaption class="photo__caption">
<blockquote class="photo__quote">
Look at me!
</blockquote>
</figcaption>
</figure>
output
.photo {
}
.photo__img {
}
.photo__caption {
}
.photo__quote {
}
Usage
npm install extract-classnames
npx excn --src ./test/index.html --dest ./test/index.css
global install
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
extract-classnames --src ./test/index.html --dest ./test/index.css
API
extract
const excn = require('extract-classnames');
const result = excn.extract(html);
extractByFile
const excn = require('extract-classnames');
excn.extractByFile('/path/to/filename').then((css) => {
console.log(css);
});