8000 GitHub - triggity/react-coffee: sample project with coffeescript and react
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

triggity/react-coffee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React-Coffeescript


Description

Coffeescript + React = Awesome. Here's a sample with grunt runners to get you started,

What's In It

Coffeescript React.js -> views Require.js -> AMD modules Grunt -> task runners less -> css Flask -> web server

Making it a Flask blueprint is just to make it easy to drop into a flask app. Just change the script/style tags register this blueprint in your flask app, mounted at UI. Read more about Blueprints

Get Started

Depends

npm install -g coffeescript
npm install -g grunt-cli

Build

npm install
grunt build

Watch for coffeescript/react/less changes

grunt watch

Info

React-coffeescript relationship

In order to build React components in coffeescript with jsx, you need to compile .coffee to .jsx and then to .js the grunt build command will compile your static/coffee folder to .jsx and compile that to .js. It will also compile your .less as well Lastly, it will copy the sourcemaps over appropriately

Gotchas

React makes use of jsx, which has html/xml like tags. This will break the coffeescript compiler. Theres two solutions to writing react components in coffeescript.

1) Escape jsx (ehh, but looks cool)
`(<HelloMessage name=Michael />)`
2) Write non-jsx React DOM components (better)
(HelloMessage {name:Michael}, []) 

With the latter, you can compile straight to javascript and skip the jsx

About

sample project with coffeescript and react

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0