cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <!-- Embed tript -->
<script src="https://cdn.rawgit.com/misantronic/tript/master/dist/tript.min.js"></script>

<!-- TEMPLATE -->
<script id="template" type="text/html">
	<div id="content">
		<h1>my awesome $app blog</h1>
		<div style="font-weight: bold;">$headline</div>

		<div id="posts">

			for(var i in posts) {
				<div class="post">
					var title = posts[i].title,
						date = posts[i].date,
						body = posts[i].body;

					<h2>#<% +i+1 %>, $title on $date|format</h2>



		var fav_animal = "Crow";
		<p>Your should know: my favorite animal is the <b>$fav_animal</b>.</p>
              body {
  font-family: Arial, sans-serif;
  font-size: 13px;
  color: #333;
  width: 400px;

h1 { font-size: 22px; border-bottom: 1px solid #333; }

h2 { font-size: 16px }

#posts .post {
  border: 1px solid #333;
  padding: 5px 15px;
  margin: 10px 0;
              // called from template
T.format = function(date) {
	return date.getMonth() +"."+ date.getDate() +"."+ date.getFullYear();

// set context
var context = {
	app: 'tript',
	headline: 'A tiny Template-Engine mixing up HTML and pure JavaScript in one template',
	description: 'tript is a freakin\' tiny template-engine which allows you to mixup JavaScript and HTML.',
	posts: [
			title: 'Big News',
			date: new Date('2014-11-14'),
			body: 'tript is great!'
			title: 'Bad News',
			date: new Date('2014-11-11'),
			body: "tript doesn't exist yet :("

// parse template
document.body.innerHTML = T(template.innerHTML, context);
Loading ..................