1
1
var build = require ( './build/build.js' ) ,
2
- lint = require ( './build/hint.js' ) ;
2
+ lint = require ( './build/hint.js' ) ;
3
3
4
4
var COPYRIGHT = '/*\n Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin\n' +
5
- ' Leaflet is a modern open-source JavaScript library for interactive maps.\n' +
5
+ ' Leaflet is an open-source JavaScript library for mobile-friendly interactive maps.\n' +
6
6
' http://leaflet.cloudmade.com\n*/\n' ;
7
7
8
8
desc ( 'Check Leaflet source for errors with JSHint' ) ;
9
9
task ( 'lint' , function ( ) {
10
+
10
11
var files = build . getFiles ( ) ;
11
12
12
13
console . log ( 'Checking for JS errors...' ) ;
@@ -23,19 +24,19 @@ task('lint', function () {
23
24
24
25
desc ( 'Combine and compress Leaflet source files' ) ;
25
26
task ( 'build' , [ 'lint' ] , function ( compsBase32 , buildName ) {
26
- var pathPart = 'dist/leaflet' + ( buildName ? '-' + buildName : '' ) ,
27
- srcPath = pathPart + '-src.js' ,
28
- path = pathPart + '.js' ;
29
27
30
28
var files = build . getFiles ( compsBase32 ) ;
31
29
32
30
console . log ( 'Concatenating ' + files . length + ' files...' ) ;
33
-
34
- var content = build . combineFiles ( files ) ;
35
31
36
- var oldSrc = build . load ( srcPath ) ,
37
- newSrc = COPYRIGHT + content ,
38
- srcDelta = build . getSizeDelta ( newSrc , oldSrc ) ;
32
+ var content = build . combineFiles ( files ) ,
33
+ newSrc = COPYRIGHT + content ,
34
+
35
+ pathPart = 'dist/leaflet' + ( buildName ? '-' + buildName : '' ) ,
36
+ srcPath = pathPart + '-src.js' ,
37
+
38
+ oldSrc = build . load ( srcPath ) ,
39
+ srcDelta = build . getSizeDelta ( newSrc , oldSrc ) ;
39
40
40
41
console . log ( '\tUncompressed size: ' + newSrc . length + ' bytes (' + srcDelta + ')' ) ;
41
42
@@ -48,9 +49,10 @@ task('build', ['lint'], function (compsBase32, buildName) {
48
49
49
50
console . log ( 'Compressing...' ) ;
50
51
51
- var oldCompressed = build . load ( path ) ,
52
- newCompressed = COPYRIGHT + build . uglify ( content ) ,
53
- delta = build . getSizeDelta ( newCompressed , oldCompressed ) ;
52
+ var path = pathPart + '.js' ,
53
+ oldCompressed = build . load ( path ) ,
54
+ newCompressed = COPYRIGHT + build . uglify ( content ) ,
55
+ delta = build . getSizeDelta ( newCompressed , oldCompressed ) ;
54
56
55
57
console . log ( '\tCompressed size: ' + newCompressed . length + ' bytes (' + delta + ')' ) ;
56
58
0 commit comments