Skip to content
This repository has been archived by the owner on Jul 4, 2019. It is now read-only.

jxnblk/styled-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 name
  • type: HTML tag or React component type
  • style: string of the template literal argument
  • defaultProps: object of the component's defaultProps
  • imports: array of imports for the module

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published