forked from patosai/tree-multiselect.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
113 lines (93 loc) · 2.31 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
var browserify = require("browserify");
var fs = require("fs");
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
eslint: {
target: ['src/**/*.js'],
options: {
configFile: '.eslintrc.yml'
}
},
browserify: {
dist: {
options: {
transform: ['babelify']
},
files: {
'dist/jquery.tree-multiselect.js': ['src/tree-multiselect.js']
}
}
},
// Karma runner
karma: {
options: {
configFile: 'conf/karma.js',
},
local: {},
watch: {
autoWatch: true,
singleRun: false
}
},
// SASS compiler
sass: {
options: {
sourceMap: false
},
build: {
options: {
outputStyle: 'compressed'
},
files: {
'dist/jquery.tree-multiselect.min.css': 'src/style.scss'
}
},
min: {
options: {
outputStyle: 'nested'
},
files: {
'dist/jquery.tree-multiselect.css': 'src/style.scss'
}
}
},
// Uglify JS
uglify: {
dist: {
options: {
preserveComments: false,
},
files: {
'dist/jquery.tree-multiselect.min.js': ['dist/jquery.tree-multiselect.js']
}
}
},
// Put headers on distributed files
usebanner: {
dist: {
options: {
position: 'top',
banner: "/* jQuery Tree Multiselect v<%= pkg.version %> | (c) Patrick Tsai | MIT Licensed */",
linebreak: true
},
files: {
src: ['dist/*.js', 'dist/*.css']
}
}
}
});
grunt.loadNpmTasks('grunt-banner');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('lint', ['eslint']);
grunt.registerTask('build', ['browserify']);
grunt.registerTask('test', ['lint', 'karma:local']);
grunt.registerTask('test-watch', ['karma:watch']);
grunt.registerTask('release', ['test', 'build', 'uglify', 'sass:build', 'sass:min', 'usebanner']);
grunt.registerTask('watch', ['test-watch']);
grunt.registerTask('default', 'test');
};