This repository has been archived by the owner on Feb 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
/
Gruntfile.js
128 lines (112 loc) · 4.06 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
module.exports = function (grunt) {
'use strict';
var environment = grunt.option('env') || 'ui',
destination = grunt.option('dest') || 'temp',
lib = {
'mobile': 'Zepto',
'ui': 'jQuery'
},
files = require('./libs/files/' + environment);
// Project configuration.
grunt.initConfig({
'pkg': grunt.file.readJSON('package.json'),
'banner': {
'full': [
'/*!',
' * Chico UI v<%= pkg.version %>',
' * http://chico-ui.com.ar/',
' *',
' * Copyright (c) <%= grunt.template.today("yyyy") %>, MercadoLibre.com',
' * Released under the MIT license.',
' * http://chico-ui.com.ar/license',
' */\n'
].join('\n'),
'min': '/*! Chico UI v<%= pkg.version %> chico-ui.com.ar | chico-ui.com.ar/license */'
},
'concat': {
'options': {
'stripBanners': {
'options': {
'block': true,
'line': true
}
}
},
'core': {
'options': {
'banner': '<%= banner.full %>' + "\n\n(function (window, $) {\n\t'use strict';\n\n",
'footer': '\n\twindow.ch = ch;\n}(this, ' + lib[environment] + '));'
},
'src': files.JS.core,
'dest': 'temp/' + environment + '/core.tmp.js'
},
'js': {
'src': ['temp/' + environment + '/core.tmp.js'].concat(files.JS.abilities).concat(files.JS.components),
'dest': destination + '/' + environment + '/chico.js'
},
'css': {
'options': {
'banner': '<%= banner.full %>'
},
'src': files.CSS.resetML.concat(files.CSS.core).concat(files.CSS.components),
'dest': destination + '/' + environment + '/chico.css'
}
},
'uglify': {
'options': {
'mangle': false,
'banner': '<%= banner.min %>'
},
'min': {
'src': ['<%= concat.js.dest %>'],
'dest': destination + '/' + environment + '/chico.min.js'
}
},
'cssmin': {
'options': {
'banner': '<%= banner.min %>',
'keepSpecialComments': 0
},
'ui-css': {
'src': ['<%= concat.css.dest %>'],
'dest': destination + '/' + environment + '/chico.min.css'
}
},
'clean': ["temp/**/*.tmp.js"],
'jslint': { // configure the task
'files': files.JS.abilities.concat(files.JS.components),
'directives': {
'nomen': true,
'todo': true
},
'options': {
'errorsOnly': true, // only display errors
'failOnError': false, // defaults to true
'shebang': true, // ignore shebang lines
}
},
'jsdoc': {
'dist': {
'src': files.JS.core.concat(files.JS.abilities).concat(files.JS.components),
'options': {
'template': './libs/doc-template',
'destination': './doc/' + environment,
'private': false
}
}
}
});
// Load plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-jslint');
grunt.loadNpmTasks('grunt-jsdoc');
// Resgister task(s).
grunt.registerTask('default', []);
grunt.registerTask('lint', ['jslint']);
grunt.registerTask('doc', ['jsdoc']);
grunt.registerTask('dev', ['concat', 'clean']);
grunt.registerTask('prod', ['concat', 'uglify', 'cssmin', 'clean']);
};