Skip to content

Commit

Permalink
Slight changes in Getting Started section
Browse files Browse the repository at this point in the history
- Mention the importance of using script-tags and no
  other DOM elements as container for templates
- Recommendation to precompile template (rather than
  just saying "you could")

see handlebars-lang/handlebars.js#604
  • Loading branch information
nknapp committed Jul 21, 2017
1 parent 2bd3235 commit 73d98f1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/images/warning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 8 additions & 6 deletions src/pages/index.haml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
</div>
</div>
</script>

.notes.warning
It is important that you put the template inside a <code>&lt;script&gt;</code>-tag. Do
not put it into the HTML directly or the HTML-parser might modify it (for example, if
it <a href="https://html.spec.whatwg.org/multipage/parsing.html#unexpected-markup-in-tables">contains a table</a>)
.bullet
.description
Compile a template in JavaScript by using
Expand All @@ -54,11 +57,10 @@
var source = $("#entry-template").html();
var template = Handlebars.compile(source);
.notes
It is also possible to precompile your templates. This will
result in a smaller required runtime library and significant
savings from not having to compile the template in the
browser. This can be especially important when working with
mobile devices.
Please note that this approach is not recommended for production applications.
A better way is to precompile your templates. This will result in a smaller required
runtime library and significant savings from not having to compile the template in the
browser. This can be especially important when working with mobile devices.
= link("Learn More: Precompilation", "precompilation.html", :class => "more-info")

.bullet
Expand Down
6 changes: 6 additions & 0 deletions src/stylesheets/application.sass
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ ul.bullet
margin-top: 10px
&+ .description
margin-top: 20px
&.warning
padding-left: 40px
background-image: url('../images/warning.svg')
background-repeat: no-repeat
background-position: left center
background-size: 30px 30px

pre
+liquid
Expand Down

0 comments on commit 73d98f1

Please sign in to comment.