This repository was archived by the owner on Jan 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspectrum.html
More file actions
183 lines (116 loc) · 4.23 KB
/
spectrum.html
File metadata and controls
183 lines (116 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Spectrum</title>
<script type="text/javascript" src="/thirdparty/prettify/prettify.js"></script>
<script type="text/javascript" src="/thirdparty/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="/site.js"></script>
<link rel="stylesheet" type="text/css" href="/style/pages.css" />
<link rel="stylesheet" type="text/css" href="/thirdparty/prettify/prettify.css"/>
<!--[if IE 6]>
<style>.content { height: 100%;}</style>
<![endif]-->
</head>
<body class="">
<div class="section-title">
<a href="/spectrum.html">Spectrum</a>
</div>
<ul class="quick-links">
<li>
<a href="/proton.html">Proton</a>
</li>
<li>
<a href="/micro.html">Micro</a>
</li>
<li>
<a href="/litmus.html">Litmus</a>
</li>
</ul>
<div class="page">
<div class="page-inner">
<div class="column">
<ul class="navigation local-navigation">
<li class="selected">
<a href="/spectrum.html">Getting Started</a>
</li>
<li>
<a href="/spectrum/using-spectrum-with-micro.html">Using with Micro</a>
</li>
<li>
<a href="/spectrum/syntax.html">Syntax</a>
</li>
</ul>
</div>
<div class="column content">
<p>
Spectrum.js is a JavaScript template language targetted at both the server (e.g. node.js) and the client-side.
</p>
<p>
It has a lightweight syntax, using embedded JavaScript for logic rather than inventing yet another language to learn.
This "logic-ful" template approach ensures that all of you view logic can live within your views, in contrast to the some recent "logic-less" template" systems.
</p>
<p>
It also borrows heavilly from <a href="http://masonhq.com/">Mason</a> to achieve high levels of reuse within your templates.
</p>
<h2>Installing</h2>
<p>
<a href="http://npmjs.org/">Npm</a> is recommended for development, although for production you might want to find/build a package for your operating system:
</p>
<pre><code>npm install spectrum</code></pre>
<h2>A Basic Example</h2>
<p>
Create a <code>views/index.spv</code> file within a <a href="http://node.js/">node.js</a> project, containing the following:
</p>
<pre><code class="prettyprint"><~inherit none />
one plus one is <%= 1 + 1 %></code></pre>
<p>
This template can be rendered with the following code.
Adjust the file paths as appropriate.
</p>
<pre><code class="prettyprint">var Spectrum = require('spectrum');
var view = new Spectrum.Renderer(__dirname + '/../views');
view.render('/index.spv', {}).then(function (output) {
// rendered content is available in the output variable
});</code></pre>
<p>
This example assumes that the file you invoke it from is in a directory that is a sibling of the views directory.
</p>
<p>
You can <a href="/spectrum/using-spectrum-with-micro.html">use Spectrum with Micro</a>.
<div class="ribbon">
<a href="http://github.com/usenode/spectrum.js" rel="me">Fork me on GitHub</a>
</div>
</div>
</div>
</div>
<div class="site">
<div class="site-logo">
<a href="/">use.no.de</a>
</div>
<ul class="global-navigation">
<li>
<a href="/proton.html">Proton</a>
</li>
<li>
<a href="/micro.html">Micro</a>
</li>
<li class="selected">
<a href="/spectrum.html">Spectrum</a>
</li>
<li>
<a href="/swipe.html">Swipe</a>
</li>
<li>
<a href="/litmus.html">Litmus</a>
</li>
<li>
<a href="/contact.html">Contact</a>
</li>
</ul>
<div class="copyright">
Site developed by <a href="http://github.com/tomyan">Tom Yandell</a> & <a href="http://www.twitter.com/richardhodgson">Richard Hodgson</a>.
</div>
</div>
</body>
</html>