Skip to content

Instantly share code, notes, and snippets.

@teaplanet
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save teaplanet/74cea492f712da193102 to your computer and use it in GitHub Desktop.

Select an option

Save teaplanet/74cea492f712da193102 to your computer and use it in GitHub Desktop.
Ractive.js Tutorial 1-4
<!-- http://learn.ractivejs.org/hello-world/4 -->
<script src='http://cdn.ractivejs.org/latest/ractive.min.js'></script>
<div id='container'></div>
<script id='template' type='text/ractive'>
<p style='color: {{color}}; font-size: {{size}}em; font-family: {{font}};'>{{greeting}} {{name}}!</p>
</script>
var ractive = new Ractive({
el: 'container',
template: '#template',
data: {
greeting: 'Hello',
name: 'world',
color: 'purple',
size: 4,
font: 'Georgia'
}
});
ractive.set({
color: 'red',
font: 'Comic Sans MS'
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment