JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Thorax Example</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery-1.8.0.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0.beta6/handlebars.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/js/bootstrap.min.js"></script>
<script src="https://raw.github.com/walmartlabs/thorax/master/dist/thorax.js"></script>
<script src="https://raw.github.com/gist/3504663/d1e6321e9fdb69ff47d636eab5df5e52acb64ae0/gistfile1.txt"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css"/>
</head>
<body>
</body>
</html>
CoffeeScript
ParagraphView = Thorax.View.extend
template: """
<p>I'm inside another view, I'll be treated
as my own distinct view.</p>
"""
EmbedExampleView = Thorax.View.extend
name: 'embed-example'
events:
'click p': ->
@log 'p clicked!'
paragraphOne: new ParagraphView
paragraphThree: $("<p>I'm inside a DOM element
that was created with $ and will be treated
as part of the view.</p>")
template: """
<h3>A Tale of Three Paragraphs</h3>
{{view paragraphOne}}
{{template "paragraph-two"}}
{{element paragraphThree}}
"""
Thorax.templates['paragraph-two'] = Handlebars.compile """
<p>I'll be embedded directly as a part of the
template and be treated as part of the view.</p>
"""
Application.setView new EmbedExampleView