Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding instructions for chrome. (No server needed! Just execute a single... #46

Merged
merged 1 commit into from
Jun 3, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 52 additions & 20 deletions examples/basic-jsx-external/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,66 @@
<meta http-equiv='Content-type' content='text/html; charset=utf-8'>
<title>Basic Example with external JSX</title>
<link rel="stylesheet" href="../shared/css/base.css" />
<style type="text/css" media="screen">
.codeBox {
padding: 7px;
overflow:scroll;
background-color: #eee;
font-weight:normal;
}
</style>
<script type="text/javascript" charset="utf-8">
window.setTimeout(function() {
var chromeClientCLI = window.chromeClientCLI;
var errorBox = window.errorBox;
var chromeErrorFooter = window.chromeErrorFooter;
var chromeInstructions = window.chromeInstructions;
var isChrome = !!window.chrome;
chromeClientCLI.innerText =
'open -a "Google Chrome" --new \\\n' +
' ' + window.location.href + ' \\\n' +
' --args --allow-file-access-from-files --user-data-dir=/tmp';

errorBox.innerText =
isChrome ? 'To run in Chrome, do one of the following:' :
'Errors loading page: Check the console.'
chromeErrorFooter.innerText =
isChrome ? 'If page still does not load, check console.' : '';

if (!isChrome) {
chromeInstructions.innerText = "";
}
}, 0);

</script>
</head>

<body>
<h1>Basic Example with external JSX</h1>
<div id="container">
<p>
If you can see this, React is not working right. This is probably because you&apos;re viewing
this on your file system instead of a web server. Try running
<pre>
python -m SimpleHTTPServer
</pre>
and going to <a href="http://localhost:8080/">http://localhost:8080/</a>.
<h4 id="errorBox" style="color: #733"></h4>
<ol id="chromeInstructions">
<li>
Open this page on a Mac via the terminal command:
<pre id="chromeClientCLI" class="codeBox">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close this?

</li>
<h4><i>OR</i></h4>
<li>
Serve this page from a web server
<pre id="chromeServerCLI" class="codeBox">
cd /Path/To/This/File
python -m SimpleHTTPServer
open -a "Google Chrome" <a href="http://localhost:8080/">http://localhost:8080/</a>. </pre>
</li>
</ol>
<h4 id="chromeErrorFooter" style="color: #733"></h4>
</p>
</div>
<h4>Example Details</h4>
<ul>
<li>
This is built with
<a href="https://github.com/substack/node-browserify">browserify</a>.
</li>
<li>
This is written with JSX in a separate file and transformed in the browser.
</li>
</ul>
<p>
</p>
<p>
Learn more at
<a href="http://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
Example Details: This is built with
<a href="https://github.com/substack/node-browserify">browserify</a>.
A separate JSX file is transformed in the browser.
</p>
<script src="../../build/react.js"></script>
<script src="../../build/JSXTransformer.js"></script>
Expand Down