# Builds the browser bundle for sutra
browserify ./browser-shim.js --standalone SUTRA -o ./dist/sutra.js -t babelify

# Copy the sutra.js file to ./examples/browser
cp ./dist/sutra.js ./examples/browser/sutra.js

# Copy the sutra.js file to ../yantra.gg/public/js
cp ./dist/sutra.js ../yantra.gg/public/sutra.js
# Copy the sutra.min.js file to ../yantra.gg/public/js
cp ./dist/sutra.min.js ../yantra.gg/public/sutra.min.js

# Copy the ./examples/browser folder to ../yantra.gg/public/sutra
cp -r ./examples/browser/ ../yantra.gg/public/sutra

# Minifies the generated bundle and creates a source map
uglifyjs ./dist/sutra.js --compress --mangle --source-map "url='sutra.min.js.map',root='../',includeSources" -o ./dist/sutra.min.js
