• Stars
    star
    170
  • Rank 223,357 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Quick online tool to transform CSS into React style JSON

What is it?

Allows you to paste plain CSS into a <textarea>, it will automatically transform that into something you can copy right into a React component inline style.

See it in action: CssToReact

The story behind it...

So you're working on a React app. It's up and running in you're favorite browser but you notice an issue with some layout. You think, ok, this should be easy to fix. You open up the developer tools, hack on some CSS within the browser till you get it looking just the way you want it to. Maybe it's several CSS properties you added or tweaked so you copy each of them into the clipboard so you can transfer them back to your application.

Then you realize, these styles aren't coming from a CSS style sheet, they're in-line styles right in you're React component.

Now you're like, FINE, I'll manually translate this to React-style-inline-CSS. This is fine if you do it once, but maybe you missed removing a dash and mis-cased a letter or maybe you forgot a comma, or left a semicolon in the converted style translationโ€ฆ Never happened to you? Oh, you are so amazing if only I was as cool as you. For myself and probably another 1 or 2 of you out there I hacked together a little tool that automates this translation. Maybe this should be a plugin to my text editor where I can right click and say "Paste as React Style" instead, but for now it's a single simple little web page that will automate the translation for you.

So one night I was searching the React interwebs thinking someone had to have build this tool already. Unfortunately I didn't find it anywhere but I DID find this handy little tool raphamorim/native-css which is a CLI version of what I wanted in the browser. So thanks to the quick bootstrap based on that tool, I was able to put this little project together in just a short evening...

Hack on this repo

npm install
npm run dev

More Repositories

1

react-component-errors

Utility React error handler decorator. Described in the following blog post:
JavaScript
50
star
2

PaginatedCollectionView

Check out the blog post...
Objective-C
40
star
3

EventAggregator.Net

Simple .Net EventAggregator class.
C#
31
star
4

ExceptionMessageBeautifier

Contains a helper that can be used to format exception messages.
C#
30
star
5

StatLight

Silverlight Testing Automation Tool
C#
30
star
6

GitRebaseReflogFixSample

One approach to fixing a bad rebase.
18
star
7

DevMachineSetup

My default developer Powershell profile
PowerShell
17
star
8

example-working-docker-compose-environment-vars

Shell
17
star
9

diffXcodeTargets

Command line tool that can be used to diff two Xcode targets source files, frameworks and build settings.
JavaScript
10
star
10

DumpToText

Check out the blog post...
C#
10
star
11

PutOnAHelmet

Set of build script/tasks that you can use to easily run to install git pre-commit hooks for such things as running tests before your code is committed.
9
star
12

Scripts

Powershell and other stuff I throw in here...
PowerShell
8
star
13

CommandAllThings

Command wrapper for task runners (gulp/grunt/rake/etc) allowing you to accidentally type the wrong starting command and still accomplish the actual task.
PowerShell
7
star
14

ODataMuscle

Provide some strongly types reflection helpers around OData
C#
7
star
15

PowerShellPresentation

Presentation material for an introduction to PowerShell
PowerShell
6
star
16

sample-docker-compose-multiple-environment

Shell
5
star
17

skypeit

Quickly and easily paste a conference call text at the command line and let SkypeIt dial the number and extension for you.
JavaScript
5
star
18

sample-pouch-couch-databaseperuser

JavaScript
5
star
19

S.O.L.I.D.

C#
2
star
20

javascript-promise-test

JavaScript
2
star
21

JavascriptAsyncAwaitPresentation

Details from a talk I gave about async/await
JavaScript
2
star
22

WinJSBrowserHistory

JavaScript
2
star
23

winjs-self-built

JavaScript
1
star
24

snapdir

JavaScript
1
star
25

boxen-vertigo

Trying out boxen on my work laptop
Ruby
1
star
26

CrossPlatNodeJSPresentation

JavaScript
1
star
27

TestFlightBetaEntitlement

Cordova Plugin that creates the `Entitlement.plist` necessary to deploy cordova apps to the new TestFlight Beta.
JavaScript
1
star
28

sample-azure-node-version

Shell
1
star