Khan / aphrodite

Framework-agnostic CSS-in-JS with support for server-side rendering, browser prefixing, and minimum CSS generation
5.34k stars 188 forks source link

Feature request: Conversion helper CSS -> Aphrodite #230

Open Soreine opened 7 years ago

Soreine commented 7 years ago

I was wondering if anyone had made a tool to "convert" style rules from a CSS syntax to a JS object syntax, as accepted by Aphrodite.

This does not need to be fancy, nor smart. Just a small helper to help importing existing CSS rules into Aphrodite. The rules would still need to be refactored manually of course, but at least, the directives would be camel cased as needed, and semi-colons would be converted to colons etc.

Example:

.my-class {
    transform: translateX(-90%);
    padding-bottom: 3;
}

Becomes


{
    myClass: {
        transform: 'translateX(-90%)',
        paddingBottom: '3'
    }
}
vbalcom commented 6 years ago

A CSS to JS Object converter may help with that: https://github.com/raphamorim/native-css