2011-12-12 18:44:16 +08:00
|
|
|
var build = require('./build/build.js');
|
2011-12-12 08:32:53 +08:00
|
|
|
|
|
|
|
var COPYRIGHT = "/*\n Copyright (c) 2010-2011, CloudMade, Vladimir Agafonkin\n" +
|
|
|
|
" Leaflet is a modern open source JavaScript library for interactive maps.\n" +
|
|
|
|
" http://leaflet.cloudmade.com\n*/\n";
|
|
|
|
|
2011-12-12 17:42:42 +08:00
|
|
|
task('build', function (compsBase32, buildName) {
|
|
|
|
var name = buildName || 'custom',
|
|
|
|
savePath = 'dist/leaflet' + (compsBase32 ? '-' + name : '') + '.js';
|
2011-12-12 08:32:53 +08:00
|
|
|
|
2011-12-12 18:44:16 +08:00
|
|
|
var files = build.getFiles(compsBase32);
|
2011-12-12 08:32:53 +08:00
|
|
|
|
|
|
|
console.log('Concatenating ' + files.length + ' files...');
|
|
|
|
|
2011-12-12 18:44:16 +08:00
|
|
|
var content = build.combineFiles(files);
|
2011-12-12 17:42:42 +08:00
|
|
|
|
2011-12-12 04:45:49 +08:00
|
|
|
console.log('Uncompressed size: ' + content.length);
|
|
|
|
console.log('Compressing...');
|
2011-12-12 08:32:53 +08:00
|
|
|
|
2011-12-12 18:44:16 +08:00
|
|
|
var compressed = COPYRIGHT + build.uglify(content);
|
2011-12-12 08:32:53 +08:00
|
|
|
|
2011-12-12 04:45:49 +08:00
|
|
|
console.log('Compressed size: ' + compressed.length);
|
|
|
|
|
2011-12-12 18:44:16 +08:00
|
|
|
build.save(savePath, compressed);
|
2011-12-12 04:45:49 +08:00
|
|
|
|
2011-12-12 17:42:42 +08:00
|
|
|
console.log('Saved to ' + savePath);
|
2011-12-12 04:45:49 +08:00
|
|
|
});
|
|
|
|
|
2011-12-12 08:32:53 +08:00
|
|
|
task('default', ['build']);
|
2011-12-12 17:42:42 +08:00
|
|
|
|
|
|
|
// TODO task('lint')
|