-
Notifications
You must be signed in to change notification settings - Fork 1
/
gruntfile.js
89 lines (78 loc) · 2.18 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
var _ = require('lodash');
var path = require('path');
function loadConfig(path, config, grunt) {
var glob = require('glob'),
obj = {},
key;
if(path[path.length - 1] !== '/') {
path += '/';
}
glob.sync('*', {cwd: path}).forEach(function(option) {
key = option.replace(/\.js$/,'');
obj[key] = require(path + option)(config, grunt);
});
return obj;
};
var config = {
license: 'license.txt',
version: '<%= pkg.version %>',
name: 'platypusui',
folders: {
src: 'src/',
examples: 'examples/',
test: 'test/',
dist: 'dist/'
},
build: {
dest: {
ts: 'dist/platypusui.ts',
tslocal: 'dist/platypusui-local.ts',
dts: 'dist/platypusui.d.ts',
dtslocal: 'dist/platypusui-local.d.ts',
js: 'dist/platypusui.js',
jslocal: 'dist/platypusui-local.js',
min: 'dist/platypusui.min.js',
minlocal: 'dist/platypusui-local.min.js',
less: 'dist/platypus.less',
css: 'dist/platypus.css',
mincss: 'dist/platypus.min.css'
}
},
examples: {
css: 'examples/style.css',
less: 'examples/style.less'
}
};
module.exports = function load(grunt) {
grunt.initConfig(_.extend({
pkg: grunt.file.readJSON('package.json')
}, loadConfig('./build/options', config, grunt)));
require('load-grunt-tasks')(grunt, {
pattern: ['grunt-*', '!grunt-contrib-less', '!grunt-less-bundle']
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.renameTask('less', 'lessCompile');
grunt.loadNpmTasks('grunt-less-bundle');
// By default, run all tests.
grunt.registerTask('default', [
'clean:before',
'bundle',
'less',
'lessCompile:main',
'cssmin',
'copy:main',
'copy:local',
'ts',
'copy:rmLibs',
'uglify',
'copy:typings',
'copy:typingslocal',
'copy:fonts',
'clean:after'
]);
grunt.registerTask('docs', [
'clean',
'bundle'
]);
grunt.registerTask('examples', ['lessCompile:examples', 'watch']);
};