cleanup Jakefile

This commit is contained in:
Vladimir Agafonkin 2012-07-12 10:39:22 +03:00
parent 4edfaee008
commit 9aa723d95b

View File

@ -1,12 +1,13 @@
var build = require('./build/build.js'),
lint = require('./build/hint.js');
lint = require('./build/hint.js');
var COPYRIGHT = '/*\n Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin\n' +
' Leaflet is a modern open-source JavaScript library for interactive maps.\n' +
' Leaflet is an open-source JavaScript library for mobile-friendly interactive maps.\n' +
' http://leaflet.cloudmade.com\n*/\n';
desc('Check Leaflet source for errors with JSHint');
task('lint', function () {
var files = build.getFiles();
console.log('Checking for JS errors...');
@ -23,19 +24,19 @@ task('lint', function () {
desc('Combine and compress Leaflet source files');
task('build', ['lint'], function (compsBase32, buildName) {
var pathPart = 'dist/leaflet' + (buildName ? '-' + buildName : ''),
srcPath = pathPart + '-src.js',
path = pathPart + '.js';
var files = build.getFiles(compsBase32);
console.log('Concatenating ' + files.length + ' files...');
var content = build.combineFiles(files);
var oldSrc = build.load(srcPath),
newSrc = COPYRIGHT + content,
srcDelta = build.getSizeDelta(newSrc, oldSrc);
var content = build.combineFiles(files),
newSrc = COPYRIGHT + content,
pathPart = 'dist/leaflet' + (buildName ? '-' + buildName : ''),
srcPath = pathPart + '-src.js',
oldSrc = build.load(srcPath),
srcDelta = build.getSizeDelta(newSrc, oldSrc);
console.log('\tUncompressed size: ' + newSrc.length + ' bytes (' + srcDelta + ')');
@ -48,9 +49,10 @@ task('build', ['lint'], function (compsBase32, buildName) {
console.log('Compressing...');
var oldCompressed = build.load(path),
newCompressed = COPYRIGHT + build.uglify(content),
delta = build.getSizeDelta(newCompressed, oldCompressed);
var path = pathPart + '.js',
oldCompressed = build.load(path),
newCompressed = COPYRIGHT + build.uglify(content),
delta = build.getSizeDelta(newCompressed, oldCompressed);
console.log('\tCompressed size: ' + newCompressed.length + ' bytes (' + delta + ')');