CoffeeTags icon indicating copy to clipboard operation
CoffeeTags copied to clipboard

Add support for ReactJS for classes

Open kursion opened this issue 10 years ago • 4 comments

Hi,

first of all... this plugin is great !!! So bravo !!!

I'm using CoffeeScript with ReactJS.

Is it possible to add the following templates as a "class" ?

module.exports = Edit = React.createClass

But most of the time I'm using this little trick

module.exports = exp = {} [...] exp.Edit = Edit = React.createClass

Or can I had it myself somewhere ? Sorry I never used Rails :(

Best regards

kursion avatar Apr 02 '14 09:04 kursion

Hi! Thanks for the kind words!

Looks like this issue is related to https://github.com/lukaszkorecki/CoffeeTags/issues/29

Once I get some spare time I will look into this.

As for contributing - please have a go, I will help you out as much as I can if you prepare a pull request. Ruby is not that hard to learn, although I have to admit that CoffeeTags' code is messy in couple of places.

lukaszkorecki avatar Apr 02 '14 09:04 lukaszkorecki

By chance are you using coffee-react for the JSX transpilation or are you using the escape it with backticks approach? Or are you just not using the JSX support?

I'd like to extend this issue to include files ending in *.cjsx to the parsed files.

mtscout6 avatar Aug 15 '14 15:08 mtscout6

Ok, my initial stab at cjsx support is rather rudamentary in that it only includes cjsx files to the default files found with the recursive flag. Here is some example output so far:

output

The only thing it has picked up and should not have was the className attribute on the cjsx div element. This is something I can live with for now, but we would need to add something to exclude those cjsx portions of the code from the parser. It may make more sense to build out some plug for this as opposed to mucking up the existing parser geared exclusively for vanilla CoffeeScript. I have pushed up the code on the react branch on this repo. Thoughts?

mtscout6 avatar Aug 15 '14 16:08 mtscout6

Hi, no I'm notre using Jsx :( but I think that your stab should work for simple coffeescript and react ?

Best regards

kursion avatar Aug 18 '14 07:08 kursion