Skip to content

Commit

Permalink
adding rest of files to handlebars upgrade...
Browse files Browse the repository at this point in the history
  • Loading branch information
martoon committed May 18, 2015
1 parent 4ca641c commit ecdb6c1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions lib/mustache-wax.js
Expand Up @@ -45,11 +45,11 @@ function MustacheWax(argv, fromCli) {
else if (this.argv.beautify) {
this._render = function (ary) {
var code = ary.join(''),
ast = uglify.parser.parse(code);
ast = uglify.parse(code);
// ast = uglify.uglify.ast_mangle(ast);
// ast = uglify.uglify.ast_squeeze(ast);

code = uglify.uglify.gen_code(ast, {
code = ast.print_to_string({
beautify: true
}) + '\n';

Expand Down
3 changes: 0 additions & 3 deletions lib/templates/compile.sh
Expand Up @@ -16,6 +16,3 @@ $handlebars -s -o "$SRC_FILE" > "${SRC_NAME}.hbs"

# prefix with module.exports, so it works with node require()
echo 'module.exports = ' | cat - "${SRC_NAME}.hbs" > "${SRC_NAME}.js" && rm "${SRC_NAME}.hbs"

# beautify output in-place to enhance readability
$uglifyjs -b -nm -ns --overwrite "${SRC_NAME}.js"
28 changes: 15 additions & 13 deletions lib/templates/module.js
@@ -1,13 +1,15 @@
module.exports = function(Handlebars, depth0, helpers, partials, data) {
this.compilerInfo = [ 4, ">= 1.0.0" ];
helpers = this.merge(helpers, Handlebars.helpers);
data = data || {};
var buffer = "", stack1, stack2, functionType = "function", escapeExpression = this.escapeExpression;
buffer += 'YUI.add("' + escapeExpression((stack1 = depth0.prefix, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + escapeExpression((stack1 = depth0.name, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '", function (Y) {\n Y.namespace("' + escapeExpression((stack1 = depth0.ns, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '")["' + escapeExpression((stack1 = depth0.name, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"] = Y.Handlebars.template(';
stack2 = (stack1 = depth0.precompiled, typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
if (stack2 || stack2 === 0) {
buffer += stack2;
}
buffer += ');\n}, "@VERSION@", { "requires": ["handlebars-base"] });\n';
return buffer;
};
module.exports =
{"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = "YUI.add(\""
+ escapeExpression(lambda((depth0 != null ? depth0.prefix : depth0), depth0))
+ escapeExpression(lambda((depth0 != null ? depth0.name : depth0), depth0))
+ "\", function (Y) {\n Y.namespace(\""
+ escapeExpression(lambda((depth0 != null ? depth0.ns : depth0), depth0))
+ "\")[\""
+ escapeExpression(lambda((depth0 != null ? depth0.name : depth0), depth0))
+ "\"] = Y.Handlebars.template(";
stack1 = lambda((depth0 != null ? depth0.precompiled : depth0), depth0);
if (stack1 != null) { buffer += stack1; }
return buffer + ");\n}, \"@VERSION@\", { \"requires\": [\"handlebars-base\"] });\n";
},"useData":true}

6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -31,12 +31,12 @@
"license": "MIT",
"dependencies": {
"mkdirp": "0.3.5",
"uglify-js": "1.3.5",
"uglify-js": "2.3",
"optimist": "0.5.2",
"handlebars": "1.0.12"
"handlebars": "2.0.0"
},
"devDependencies": {
"istanbul": "~0.1.37",
"istanbul": "~0.3.13",
"mocha": "~1.11.0",
"rimraf": "~2.1.4"
},
Expand Down
1 change: 1 addition & 0 deletions test/mustache-wax-test.js
Expand Up @@ -139,6 +139,7 @@ describe("rendering", function () {
var instance = new MustacheWax({
outputFile: filePath
});

var inputFile = inputFiles[0]; // alpha

instance.invoke(path.join(inputDir, inputFile));
Expand Down

0 comments on commit ecdb6c1

Please sign in to comment.