Read a CSS file into an AST. AST format is from the css.parse
method. Methods work like fs.readFile
and fs.readFileSync
. If you supply a callback, method will be async. If not, method will be sync.
npm install read-css
const read = require('read-css')
read('example.css') // tree
const callback = (err, data) => {
if (err) throw err
console.log(JSON.stringify(data, null, 2))
}
read('example.css', callback)
const read = require('read-css')
read('test.css')
View sample AST output in test.json
npm install
npm test