for a better _.template()
the default underscore template tag is <% %>
, it's kind of hard to type for me.
so i change this into ``</code>
_ = require 'underscore'
_.templateSettings =
interpolate: /``(.+?)``/g
template = _.template 'Hello ``name``!'
prod = template
name: 'Mustache'
console.log prod
i think this is way much better ;)
Written by Nos
Related protips
2 Responses
Why not {{varName}}
for instance? Is it just a matter of your personal prefence or have you some other reasons to do so? I'm just curious.
over 1 year ago
·
you have to type shift + [
/ shift + ]
for {
or }
..
that's tired.
(i'm extremely laze, i know :P)
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Underscore
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#