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

Inheriting classes from another module #3

Open
clessg opened this issue Sep 24, 2015 · 2 comments
Open

Inheriting classes from another module #3

clessg opened this issue Sep 24, 2015 · 2 comments

Comments

@clessg
Copy link

clessg commented Sep 24, 2015

Is there a way to inherit classes from a CSS module, or are there any good alternatives? See gajus/react-css-modules#34.

@svnm
Copy link

svnm commented Nov 23, 2015

One approach I have been using, which is not really inheriting classes, but for reusable classes it can allow me to add styles from multiple css modules into a component.

let styles = {}
import grids from '../styles/grids.css'
import buttons from '../styles/buttons.css';
Object.assign(styles, grids, buttons)

example GIST

@Download
Copy link

Or, using ES6 object spread:

import grids from '../styles/grids.css'
import buttons from '../styles/buttons.css'
const styles = { ...grids, ...buttons }

In case of duplicates, the properties from the last object will overwrite previous objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants