1.0.0-0 • Published 6 years ago
styled-parser v1.0.0-0
styled-parser
Parse information from styled-components modules
npm i styled-parser
const fs = require('fs')
const path = require('path')
const parse = require('styled-parser')
const componentSource = fs.readFileSync(
path.join(__dirname, './src/Box.js')
)
const result = parse(componentSource)
Returns an object with the following:
name
: default exported component nametype
: HTML tag or React component typestyle
: string of the template literal argumentdefaultProps
: object of the component's defaultPropsimports
: array of imports for the module
1.0.0-0
6 years ago