-
Notifications
You must be signed in to change notification settings - Fork 70
/
Gruntfile.js
89 lines (78 loc) · 1.73 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
module.exports = function ( grunt ) {
var globalConfig = {
platform: '',
defaultFiles: ['src/*.js', 'src/plugins/*.js']
};
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
globalConfig : globalConfig,
/*
jsdoc: {
dist : {
src: ['src/*.js', 'src/plugins/*.js'],
options: {
destination: 'doc'
}
}
},
*/
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'src/*.js', 'src/plugins/*.js', 'src/platforms/{,*/}*.js'
]
},
cssmin: {
combine: {
files: {
'dist/smartbox.css': ['css/*.css']
}
}
},
clean: {
build: ['dist']
},
concat: {
options: {
platform: ''
},
platform: {
src: globalConfig.defaultFiles.concat(['src/platforms/<%= globalConfig.platform %>/*.js']),
dest: 'dist/smartbox.js'
},
all: {
src: globalConfig.defaultFiles.concat(['src/platforms/{,*/}*.js']),
dest: 'dist/smartbox.js'
}
},
uglify: {
build: {
files: {
'dist/smartbox.min.js' : 'dist/smartbox.js'
}
}
},
watch: {
all: {
files: ['src/*.js', 'src/platforms/{,*/}*.js', 'src/plugins/*.js' ],
tasks: ['build']
}
}
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['clean']);
grunt.registerTask('build', 'Build Smartbox for platform', function ( target ) {
var concatTask = 'concat:';
if (target && target !== 'all') {
globalConfig.platform = target;
concatTask += 'platform';
} else {
concatTask += 'all';
}
grunt.task.run('clean', concatTask ,'uglify', 'cssmin');
});
};