forked from LazarSoft/jsqrcode
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathGruntfile.js
56 lines (49 loc) · 1.61 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict';
module.exports = function(grunt) {
//Load NPM tasks
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
process: function(src, filepath) {
if (filepath.substr(filepath.length - 2) === 'js') {
return '// Source: ' + filepath + '\n' +
src.replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1');
} else {
return src;
}
}
},
main: {
src: ['src/grid.js', 'src/version.js', 'src/detector.js', 'src/formatinf.js', 'src/errorlevel.js', 'src/bitmat.js', 'src/datablock.js', 'src/bmparser.js', 'src/datamask.js', 'src/rsdecoder.js', 'src/gf256poly.js', 'src/gf256.js', 'src/decoder.js', 'src/qrcode.js', 'src/findpat.js', 'src/alignpat.js', 'src/databr.js'],
dest: 'lib/qrcode-decoder.js'
},
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> */\n',
mangle: false
},
main: {
src: 'lib/qrcode-decoder.js',
dest: 'lib/qrcode-decoder.min.js'
}
},
watch: {
main: {
files: ['src/*.js'],
tasks: 'compile',
},
},
});
//Making grunt default to force in order not to break the project.
grunt.option('force', true);
//Default task(s).
grunt.registerTask('default', ['watch']);
//Compile task (concat + minify)
grunt.registerTask('compile', ['concat', 'uglify']);
};