addyosmani / addyosmani/backbone-fundamentals

Template delimiter example doesn't work

Đang mở
#421 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rich Text Format
Star
9.2k
Fork
1.4k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

In chapter 2, it states that delimiters can be changed very simply:

``````
You may also use double curly brackets (i.e ```{{}}```) (or any other
tag you feel comfortable with) in Microtemplates. In the case of curly
brackets, this can be done by setting the Underscore
```templateSettings``` attribute as follows:

```javascript
_.templateSettings = { interpolate : /\{\{(.+?)\}\}/g };
```
``````

But that example doesn't actually work, at least with the latest versions of Underscore and Backbone. First of all, the above suggestion will clobber the `evaluate` and `escape` properties. Second, if set so that it doesn't clobber them (`_.templateSettings.interpolate = /\{\{(.+?)\}\}/g;`), the following errors will be thrown:

```
Uncaught SyntaxError: Unexpected token = underscore.js:1156
_.template underscore.js:1156
```

Unfortunately, I don't know enough about Underscore to offer a solution.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.