-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.js
31 lines (22 loc) · 877 Bytes
/
compile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var fs = require('fs');
var UglifyJS = require("uglify-js");
var browserify = require('browserify');
var version = require('./package.json');
var js = browserify(['./vendor/sockjs.js']);
js.require('./lib/', {expose:'muzzley-client'});
js.add('./lib/dist-browser.js');
js.bundle(function(err, file){
var fileName;
var minified = UglifyJS(file);
if (!fs.existsSync('dist')) {
fs.mkdirSync('dist');
}
fileName = __dirname + '/dist/muzzley-client-' + version.version + '.js';
fs.writeFileSync(fileName, file);
console.log('It\'s saved and ready to use at ' + fileName);
fileName = __dirname + '/dist/muzzley-client-' + version.version + '.min.js';
fs.writeFileSync(fileName, minified);
console.log('It\'s saved and ready to use at ' + fileName);
console.log("");
console.log("Check examples folder to find more about how to use the lib");
});