This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//cdn.getchute.com/v3/chute.min.js" data-load="view"></script> | |
<!-- Template for a container element --> | |
<script class="container-template" type="application/x-template"> | |
<div class="assets"></div> | |
</script> | |
<!-- Template for a single image --> | |
<script class="item-template" type="application/x-template"> | |
<div class="asset"> | |
<img src="{{ asset.url }}/w/200"> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Chute.require('js/script.js', function(){ | |
// script was loaded and executed | |
}); | |
Chute.require('css/style.css', function(){ | |
// stylesheet was loaded and styles were applied | |
}); | |
Chute.requireMultiple(['js/script.js', 'css/style.css'], function(){ | |
// requested files were loaded |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Wookmark</title> | |
<script src="//code.jquery.com/jquery-1.9.1.min.js"></script> | |
<!-- Include Chute.js --> | |
<script src="//cdn.getchute.com/v3/chute.min.js" data-load="view"></script> | |
<!-- Template for a container element --> | |
<script class="container-template" type="application/x-template"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Galleria</title> | |
<script src="//code.jquery.com/jquery-1.8.3.min.js"></script> | |
<!-- Include Chute.js --> | |
<script src="//cdn.getchute.com/v3/chute.min.js" data-load="view"></script> | |
<style> /* specifying dimensions for a gallery, required by Galleria */ | |
div.assets { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Grid</title> | |
<script src="//code.jquery.com/jquery-1.9.1.min.js"></script> | |
<!-- include Chute.js --> | |
<script src="//cdn.getchute.com/v3/chute.min.js" data-load="view"></script> | |
<style> /* Some basic styling for a grid */ | |
div.assets { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var share = new Chute.Share({ | |
url: 'http://my-website.com/about', | |
text: 'Check out my new website!' | |
}); | |
var links = share.generate(); | |
/* | |
links = { | |
twitter: 'URL', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var template = new Chute.View.Template({ | |
html: '<h1><%= title %></h1>', | |
render: function(data, callback) { | |
var compiledFn = _.template(this.template); | |
var rendered = compiledFn(data); | |
callback(rendered); | |
} | |
}); | |
template.render({ title: 'I am a LoDash template' }, function(result){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var template = new Chute.View.Template({ | |
html: '<h1>{{ title }}</h1>' | |
}); | |
template.render({ title: 'I am a template' }, function(result){ | |
// result contains rendered template, HTML code | |
console.log(result); // <div><h1>I am a template</h1></div> | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var template = new Chute.View.Template({ | |
html: '<div><h1>I am a template</h1></div>' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script class="my-template" type="application/x-template"> | |
<div> | |
<h1>I am a template</h1> | |
</div> | |
</script> | |
<script> | |
var template = new Chute.View.Template({ | |
selector: 'script.my-template' | |
}); |