├── .gitignore ├── readme.md ├── blaze-init.js └── export-packages.sh /.gitignore: -------------------------------------------------------------------------------- 1 | \#*# 2 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## Prerequisites 2 | 3 | Install [jq](http://stedolan.github.io/jq/download/) 4 | 5 | ## Usage 6 | 7 | Modify the value of the METEOR environment variable in `build-blaze.sh` if needed. Then run: `./build-blaze.sh`. You'll find the result in the `blaze.js` file. 8 | 9 | -------------------------------------------------------------------------------- /blaze-init.js: -------------------------------------------------------------------------------- 1 | $("script[type='text/spacebars']").each(function (index, script) { 2 | var name = script.getAttribute('name'); 3 | var renderFuncCode = SpacebarsCompiler.compile(script.innerHTML, {isTemplate: true}); 4 | eval("Template.__define__(" + JSON.stringify(name) + 5 | ", " + renderFuncCode + ");"); 6 | }); 7 | 8 | $(document).ready(function () { 9 | if (Template.main) { 10 | Blaze.render(Template.main, document.body); 11 | } 12 | }); 13 | 14 | Blaze.Var = ReactiveVar; 15 | -------------------------------------------------------------------------------- /export-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # exit on errors 4 | set -e 5 | 6 | METEOR=~/meteor/meteor 7 | 8 | rm -rf app-for-export 9 | $METEOR create app-for-export && cd app-for-export 10 | rm app-for-export.* 11 | $METEOR remove meteor-platform 12 | 13 | for var in "$@" 14 | do 15 | $METEOR add "$var" 16 | done 17 | 18 | echo "Bundling..." 19 | 20 | $METEOR build ../ --directory $METEOR_OPTIONS && cd ../ 21 | rm -f client.js 22 | 23 | pushd bundle/programs/web.browser 24 | JS_FILES=$(cat program.json | jq '.manifest[] | select(.type == "js") | .path' -r) 25 | cat $JS_FILES > ../../../client.js 26 | popd 27 | 28 | rm -rf app-for-export 29 | rm -rf bundle 30 | 31 | echo "Meteor = {};"|cat - client.js > /tmp/out && rm -f client.js && mv /tmp/out client.js 32 | 33 | exit 34 | --------------------------------------------------------------------------------