diff options
author | kpdecker <kpdecker@gmail.com> | 2013-01-13 15:32:29 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2013-01-13 15:34:27 -0600 |
commit | 3cac2672d0069b95f7b93c9c4727392246cd8984 (patch) | |
tree | 0c3c9d85f2302ca79e1606a9ef5ace110a173cf8 | |
parent | 7a3641df5acc1362845ccadd57e29eb2965a0771 (diff) | |
download | handlebars.js-3cac2672d0069b95f7b93c9c4727392246cd8984.zip handlebars.js-3cac2672d0069b95f7b93c9c4727392246cd8984.tar.gz handlebars.js-3cac2672d0069b95f7b93c9c4727392246cd8984.tar.bz2 |
Use jsmodule for jison parser
Removes unnecessary commonjs code generated for the parser. This reduces
the size of the parse by about 700bytes and should resolve lookup issues
with browserify and other static analysis tools. See #220
-rw-r--r-- | Rakefile | 4 | ||||
-rw-r--r-- | lib/handlebars/compiler/base.js | 2 | ||||
-rw-r--r-- | src/parser-prefix.js | 1 | ||||
-rw-r--r-- | src/parser-suffix.js | 4 |
4 files changed, 8 insertions, 3 deletions
@@ -2,10 +2,10 @@ require "rubygems" require "bundler/setup" def compile_parser - system "./node_modules/jison/lib/jison/cli-wrapper.js src/handlebars.yy src/handlebars.l" + system "./node_modules/jison/lib/jison/cli-wrapper.js -m js src/handlebars.yy src/handlebars.l" if $?.success? File.open("lib/handlebars/compiler/parser.js", "w") do |file| - file.puts File.read("handlebars.js") + ";" + file.puts File.read("src/parser-prefix.js") + File.read("handlebars.js") + File.read("src/parser-suffix.js") end sh "rm handlebars.js" diff --git a/lib/handlebars/compiler/base.js b/lib/handlebars/compiler/base.js index 5ce4222..6919d38 100644 --- a/lib/handlebars/compiler/base.js +++ b/lib/handlebars/compiler/base.js @@ -1,4 +1,4 @@ -var handlebars = require("./parser").parser; +var handlebars = require("./parser"); var Handlebars = require("../base"); // BEGIN(BROWSER) diff --git a/src/parser-prefix.js b/src/parser-prefix.js new file mode 100644 index 0000000..42345d6 --- /dev/null +++ b/src/parser-prefix.js @@ -0,0 +1 @@ +// BEGIN(BROWSER) diff --git a/src/parser-suffix.js b/src/parser-suffix.js new file mode 100644 index 0000000..fc8df13 --- /dev/null +++ b/src/parser-suffix.js @@ -0,0 +1,4 @@ + +// END(BROWSER) + +module.exports = handlebars; |