teleporthq / teleport-code-generators

A collection of code generators for modern JavaScript applications
https://teleporthq.io
MIT License
1k stars 160 forks source link

Styled-components / JSS imports should only appear when the component has style #214

Closed alexnm closed 5 years ago

alexnm commented 5 years ago

Both style plugins currently add the dependencies even if no style is present on the component.

For styled-components it's:

import styled from 'styled-components'

For JSS it's:

import injectSheet from 'react-jss'

and the HOC

injectSheet(style)(Component)
JayaKrishnaNamburu commented 5 years ago

@alexnm this is happening only in the case of StyledComponents, for JSS it's working fine 🤔

JayaKrishnaNamburu commented 5 years ago

JSS --> https://github.com/teleporthq/teleport-code-generators/blob/master/packages/teleport-plugin-react-jss/src/index.ts#L74

alexnm commented 5 years ago

right, I got a wrong impression from an example probably