Skip to content

Commit f963a39

Browse files
author
Himanshu Kapoor
committed
Update build process + Add dist folder to contain compiled source.
1 parent a8e9911 commit f963a39

8 files changed

+3673
-10
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ vwoapp/*
1515
.idea/*
1616
docs/*
1717
test/unit-tests.js
18-
test/dom-comparator.js
1918
testem.json
2019
node_modules
2120
bower_components

Gruntfile.js

+31-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
module.exports = function (grunt) {
33
'use strict';
44

5+
var licenseBanner = '/*!' + '\n' +
6+
'The MIT License (MIT)' + '\n' +
7+
'http://opensource.org/licenses/MIT' + '\n\n' +
8+
'Copyright (c) 2014 Wingify Software Pvt. Ltd.' + '\n' +
9+
'http://wingify.com' + '\n' +
10+
'*/\n\n' +
11+
'var VWO = window.VWO || {}; \n';
12+
513
var fs = require('fs');
614
var execSync = require('exec-sync');
715

@@ -16,10 +24,14 @@ module.exports = function (grunt) {
1624
},
1725
concat: {
1826
options: {
19-
separator: '\n'
27+
separator: '\n',
28+
process: function (src) {
29+
return licenseBanner + '(function(){\n' +
30+
src + '\n})();';
31+
}
2032
},
2133
domComparator: {
22-
dest: 'test/dom-comparator.js',
34+
dest: 'dist/dom-comparator.js',
2335
src: ['src/*.js']
2436
},
2537
unit: {
@@ -40,14 +52,29 @@ module.exports = function (grunt) {
4052
spawn: false, // don't spawn another process
4153
livereload: true // runs livereload server on 35729
4254
}
43-
}
55+
},
56+
uglify: {
57+
options: {
58+
mangle: false,
59+
wrap: 'closure',
60+
banner: licenseBanner,
61+
sourceMap: true,
62+
sourceMapIncludeSources: true
63+
},
64+
domComparator: {
65+
files: {
66+
'dist/dom-comparator.min.js': 'src/*.js'
67+
}
68+
}
69+
},
4470
});
4571

4672
grunt.loadNpmTasks('grunt-contrib-concat');
4773
grunt.loadNpmTasks('grunt-contrib-jshint');
4874
grunt.loadNpmTasks('grunt-contrib-copy');
4975
grunt.loadNpmTasks('grunt-contrib-concat');
5076
grunt.loadNpmTasks('grunt-contrib-watch');
77+
grunt.loadNpmTasks('grunt-contrib-uglify');
5178

5279
grunt.registerTask('testem', function () {
5380
var testemConfig = {
@@ -64,5 +91,5 @@ module.exports = function (grunt) {
6491
}
6592
});
6693

67-
grunt.registerTask('default', ['concat', 'testem']);
94+
grunt.registerTask('default', ['concat', 'uglify']);
6895
};

0 commit comments

Comments
 (0)