Last active
September 15, 2016 08:36
-
-
Save davemo/8199114 to your computer and use it in GitHub Desktop.
A .coffee file with Reacts JSX, compiles fine in Sublime Text using 'Coffee: Display JavaScript', but won't compile with the coffeescript CLI or the coffeeify transform for browserify. Relevant reading: http://blog.vjeux.com/2013/javascript/react-coffeescript.html and https://groups.google.com/forum/#!msg/reactjs/NHy6UNqm-zU/i6Xr0-jP7nIJ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`/** @jsx React.DOM */` | |
React = require("react") | |
$ = require("jquery-browserify") | |
converter = new Showdown.converter | |
Comment = React.createClass | |
render: -> | |
rawMarkup = converter.makeHtml @props.children.toString() | |
`<div className="comment"> | |
<h2 className="comment">{this.props.author}</h2> | |
<span dangerouslySetInnerHTML={{__html: rawMarkup}} /> | |
</div>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx React.DOM */; | |
var $, Comment, React, converter; | |
React = require("react"); | |
$ = require("jquery-browserify"); | |
converter = new Showdown.converter; | |
Comment = React.createClass({ | |
render: function() { | |
var rawMarkup; | |
rawMarkup = converter.makeHtml(this.props.children.toString()); | |
return <div className="comment"> | |
<h2 className="comment">{this.props.author}</h2> | |
<span dangerouslySetInnerHTML={{__html: rawMarkup}} /> | |
</div>; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ coffee app/js/app.coffee | |
/Users/davidmosher/code/react/tbs-battle-planner/app/js/app.coffee:15 | |
return <div className="comment"> | |
^ | |
SyntaxError: Unexpected token < | |
at Module._compile (module.js:439:25) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, it does compile with the
-c
flag which is what I was missing.