Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryanve/read-css
Read a CSS file into an abstract syntax tree object
https://github.com/ryanve/read-css
css filesystem nodejs parse readfile
Last synced: about 1 month ago
JSON representation
Read a CSS file into an abstract syntax tree object
- Host: GitHub
- URL: https://github.com/ryanve/read-css
- Owner: ryanve
- License: isc
- Created: 2017-05-23T17:56:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-16T20:50:06.000Z (over 7 years ago)
- Last Synced: 2024-10-14T04:23:19.559Z (3 months ago)
- Topics: css, filesystem, nodejs, parse, readfile
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/read-css
- Size: 13.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# read-css
Read a CSS file into an AST. AST format is from the [`css.parse`](https://www.npmjs.com/package/css) method. Methods work like `fs.readFile` and `fs.readFileSync`. If you supply a callback, method will be async. If not, method will be sync.## install
```
npm install read-css
```## usage
```
const read = require('read-css')
```### sync usage
```js
read('example.css') // tree
```### async usage
```js
const callback = (err, data) => {
if (err) throw err
console.log(JSON.stringify(data, null, 2))
}read('example.css', callback)
```## output
```js
const read = require('read-css')
read('test.css')
```[View sample AST output in `test.json`](test.json)
## develop
```
npm install
npm test
```## related
[reap-css](https://www.npmjs.com/package/reap-css)