cleanup Jakefile
This commit is contained in:
parent
4edfaee008
commit
9aa723d95b
28
Jakefile.js
28
Jakefile.js
@ -1,12 +1,13 @@
|
|||||||
var build = require('./build/build.js'),
|
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' +
|
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';
|
' http://leaflet.cloudmade.com\n*/\n';
|
||||||
|
|
||||||
desc('Check Leaflet source for errors with JSHint');
|
desc('Check Leaflet source for errors with JSHint');
|
||||||
task('lint', function () {
|
task('lint', function () {
|
||||||
|
|
||||||
var files = build.getFiles();
|
var files = build.getFiles();
|
||||||
|
|
||||||
console.log('Checking for JS errors...');
|
console.log('Checking for JS errors...');
|
||||||
@ -23,19 +24,19 @@ task('lint', function () {
|
|||||||
|
|
||||||
desc('Combine and compress Leaflet source files');
|
desc('Combine and compress Leaflet source files');
|
||||||
task('build', ['lint'], function (compsBase32, buildName) {
|
task('build', ['lint'], function (compsBase32, buildName) {
|
||||||
var pathPart = 'dist/leaflet' + (buildName ? '-' + buildName : ''),
|
|
||||||
srcPath = pathPart + '-src.js',
|
|
||||||
path = pathPart + '.js';
|
|
||||||
|
|
||||||
var files = build.getFiles(compsBase32);
|
var files = build.getFiles(compsBase32);
|
||||||
|
|
||||||
console.log('Concatenating ' + files.length + ' files...');
|
console.log('Concatenating ' + files.length + ' files...');
|
||||||
|
|
||||||
var content = build.combineFiles(files);
|
|
||||||
|
|
||||||
var oldSrc = build.load(srcPath),
|
var content = build.combineFiles(files),
|
||||||
newSrc = COPYRIGHT + content,
|
newSrc = COPYRIGHT + content,
|
||||||
srcDelta = build.getSizeDelta(newSrc, oldSrc);
|
|
||||||
|
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 + ')');
|
console.log('\tUncompressed size: ' + newSrc.length + ' bytes (' + srcDelta + ')');
|
||||||
|
|
||||||
@ -48,9 +49,10 @@ task('build', ['lint'], function (compsBase32, buildName) {
|
|||||||
|
|
||||||
console.log('Compressing...');
|
console.log('Compressing...');
|
||||||
|
|
||||||
var oldCompressed = build.load(path),
|
var path = pathPart + '.js',
|
||||||
newCompressed = COPYRIGHT + build.uglify(content),
|
oldCompressed = build.load(path),
|
||||||
delta = build.getSizeDelta(newCompressed, oldCompressed);
|
newCompressed = COPYRIGHT + build.uglify(content),
|
||||||
|
delta = build.getSizeDelta(newCompressed, oldCompressed);
|
||||||
|
|
||||||
console.log('\tCompressed size: ' + newCompressed.length + ' bytes (' + delta + ')');
|
console.log('\tCompressed size: ' + newCompressed.length + ' bytes (' + delta + ')');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user