Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "underscore-brunch",
"version": "1.4.0",
"version": "1.4.1",
"description": "Adds Underscore.js templates support to brunch.",
"author": "Daniel Trojanowski (https://github.com/trojanowski)",
"homepage": "https://github.com/trojanowski/underscore-brunch",
Expand All @@ -18,7 +18,7 @@
"node": "~0.6.10 || 0.8 || 0.9"
},
"dependencies": {
"coffee-script": "1.3.3",
"coffeescript": "^2.7.0",
"underscore": "1.4.2"
},
"devDependencies": {
Expand Down
5 changes: 4 additions & 1 deletion src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ module.exports = class UnderscoreCompiler

compile: (data, path, callback) ->
try
result = ""
templateSettings = @config.plugins?.underscore
content = _.template(data, null, templateSettings).source
result = "module.exports = #{content};"
if (content.indexOf('_.escape') != -1)
result = "var _ = require('underscore');"
result += "module.exports = #{content};"
catch err
error = err
finally
Expand Down