Skip to content

Commit

Permalink
Cherry-pick squashed version of facebook#4131 - switch website to use…
Browse files Browse the repository at this point in the history
… babel
  • Loading branch information
vipulnsward authored and zpao committed Aug 20, 2015
1 parent 356b8f3 commit 09ffdf1
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 15,940 deletions.
3 changes: 3 additions & 0 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ DEPENDENCIES
rake
rb-fsevent
sanitize (~> 2.0)

BUNDLED WITH
1.10.1
3 changes: 2 additions & 1 deletion docs/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ require('yaml')

desc "generate js from jsx"
task :js do
system "../bin/jsx --harmony _js js"
system "cp ../node_modules/babel/node_modules/babel-core/browser.min.js ./js/babel-browser.min.js"
system "../node_modules/.bin/babel _js --out-dir=js"
end

desc "watch js"
Expand Down
18 changes: 0 additions & 18 deletions docs/_js/jsx-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,16 @@ var HelloMessage = React.createClass({\n\
React.render(<HelloMessage name=\"John\" />, mountNode);\
";

function transformer(harmony, code) {
return JSXTransformer.transform(code, {harmony: harmony}).code;
}

var CompilerPlayground = React.createClass({
getInitialState: function() {
return {harmony: false};
},
handleHarmonyChange: function(e) {
this.setState({harmony: e.target.checked});
},
render: function() {
return (
<div>
<ReactPlayground
codeText={HELLO_COMPONENT}
renderCode={true}
transformer={transformer.bind(null, this.state.harmony)}
showCompiledJSTab={false}
showLineNumbers={true}
/>
<label className="compiler-option">
<input
type="checkbox"
onChange={this.handleHarmonyChange}
checked={this.state.harmony} />{' '}
Enable ES6 transforms (<code>--harmony</code>)
</label>
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/_js/live_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var ReactPlayground = React.createClass({
getDefaultProps: function() {
return {
transformer: function(code) {
return JSXTransformer.transform(code).code;
return babel.transform(code).code;
},
editorTabTitle: 'Live JSX Editor',
showCompiledJSTab: true,
Expand Down
2 changes: 1 addition & 1 deletion docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
<script type="text/javascript" src="/react/js/es5-shim.min.js"></script>
<script type="text/javascript" src="/react/js/es5-sham.min.js"></script>
<![endif]-->
<script type="text/javascript" src="/react/js/babel-browser.min.js"></script>
<script type="text/javascript" src="/react/js/codemirror.js"></script>
<script type="text/javascript" src="/react/js/javascript.js"></script>
<script type="text/javascript" src="/react/js/react.js"></script>
<script type="text/javascript" src="/react/js/JSXTransformer.js"></script>
<script type="text/javascript" src="/react/js/live_editor.js"></script>
</head>
<body>
Expand Down
Loading

0 comments on commit 09ffdf1

Please sign in to comment.