Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decide on how to handle css-modules / styled components #10

Open
StrikeForceZero opened this issue Apr 24, 2017 · 0 comments
Open

Decide on how to handle css-modules / styled components #10

StrikeForceZero opened this issue Apr 24, 2017 · 0 comments

Comments

@StrikeForceZero
Copy link
Owner

StrikeForceZero commented Apr 24, 2017

After fighting with HMR and css-modules, I see why upstream went ahead and created styled components. Originally I was against it, due to lack of IDE support. It appears I'm just rehashing an already researched and thought out topic, as I'm starting to get interest in the simplicity styled components offers. The only question is what would fit best with a typescript code base.

I like the ideas of having modules, but can't live without syntax highlighting / linting / auto-completion.


follow upstream and use styled-components?

(until a plugin for intellij is made) this is possible:
image

  • pros:
    • follows upstream
    • simple
    • navigating to deceleration will take you to the style attached to the component
  • cons:
    • requires tricks for ide support without a plugin
    • not possible to run a test/linter that detects the styled components css rules?

change it up and try react-css-modules?

  • pros:

    • decorators
    • override-able?
  • cons:

    • strings
    • new property to keep track of
import React from 'react';
import CSSModules from 'react-css-modules';
import styles from './table.css';

@CSSModules(styles)
export default class extends React.Component {
    render () {
        return <div styleName='table'>
            <div styleName='row'>
                <div styleName='cell'>A0</div>
                <div styleName='cell'>B0</div>
            </div>
        </div>;
    }
}

stick with css-modules/postcss-modules?

  • pros:
    • can type def class-names
  • cons:
    • no linting
    • camelCase only class names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant