From 536ee9c8b35ff6fa558d99321c394f405d012e0f Mon Sep 17 00:00:00 2001 From: Roman Chichina Date: Tue, 5 Jul 2022 04:26:55 +0300 Subject: [PATCH 1/4] Allow escape template without global undescore dependency --- src/index.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.coffee b/src/index.coffee index 09d37bd..16d8c46 100644 --- a/src/index.coffee +++ b/src/index.coffee @@ -11,9 +11,12 @@ module.exports = class UnderscoreCompiler compile: (data, path, callback) -> try + content = "" 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 From 4b81fa3d576447c2244b9c4d59c9f981200e6b8a Mon Sep 17 00:00:00 2001 From: Roman Chichina Date: Tue, 5 Jul 2022 04:29:30 +0300 Subject: [PATCH 2/4] Allow escape template without global undescore dependency --- src/index.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.coffee b/src/index.coffee index 16d8c46..7db4e9f 100644 --- a/src/index.coffee +++ b/src/index.coffee @@ -11,7 +11,7 @@ module.exports = class UnderscoreCompiler compile: (data, path, callback) -> try - content = "" + result = "" templateSettings = @config.plugins?.underscore content = _.template(data, null, templateSettings).source if (content.indexOf('_.escape') !== -1) From 329d6d829c06502ec82b04e0b759977858a8cbd8 Mon Sep 17 00:00:00 2001 From: Roman Chichina Date: Tue, 5 Jul 2022 04:31:39 +0300 Subject: [PATCH 3/4] Allow escape template without global undescore dependency --- src/index.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.coffee b/src/index.coffee index 7db4e9f..01930a4 100644 --- a/src/index.coffee +++ b/src/index.coffee @@ -14,7 +14,7 @@ module.exports = class UnderscoreCompiler result = "" templateSettings = @config.plugins?.underscore content = _.template(data, null, templateSettings).source - if (content.indexOf('_.escape') !== -1) + if (content.indexOf('_.escape') != -1) result = "var _ = require('underscore');" result += "module.exports = #{content};" catch err From ed69639b34431ae62e09e756089e339846ee8cd0 Mon Sep 17 00:00:00 2001 From: Roman Chichina Date: Tue, 5 Jul 2022 04:36:11 +0300 Subject: [PATCH 4/4] Update coffeescript --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5762d84..acc7a0e 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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": {