forked from thorsten/phpMyFAQ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
168 lines (161 loc) · 5.96 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/**
* phpMyFAQ Gruntfile.js
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/.
*
* @category phpMyFAQ
* @package Development
* @author Thorsten Rinne <[email protected]>
* @copyright 2013-2014 phpMyFAQ Team
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
* @link http://www.phpmyfaq.de
* @since 2013-06-23
*/
/*global module:false, require:false */
module.exports = function(grunt) {
'use strict';
// Load all tasks
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
// Metadata.
meta: {
version: '3.0.0-dev'
},
banner: '/*! phpMyFAQ v<%= meta.version %> - http://www.phpmyfaq.de - Copyright (c) 2001 - 2014 Thorsten Rinne and phpMyFAQ Team */\n',
// Task configuration.
exec: {
tinymce_less: {
cwd: 'components/tinymce',
command: 'jake less',
stdout: true,
stderr: true
},
tinymce_bundle: {
cwd: 'components/tinymce',
command: 'jake bundle',
stdout: true,
stderr: true
}
},
copy: {
tinymce: {
files: [
{
expand: true,
src: 'components/tinymce/js/tinymce/tinymce.full.min.js',
flatten: true,
dest: 'phpmyfaq/admin/assets/js/editor'
},
{
expand: true,
cwd: 'components/tinymce/js/tinymce/plugins/',
src: '**',
dest: 'phpmyfaq/admin/assets/js/editor/plugins/'
},
{
expand: true,
cwd: 'components/tinymce/js/tinymce/skins/',
src: '**/*.!(less)',
dest: 'phpmyfaq/admin/assets/js/editor/skins/'
},
{
expand: true,
cwd: 'components/tinymce/js/tinymce/themes/',
src: '**',
dest: 'phpmyfaq/admin/assets/js/editor/themes/'
}
]
}
},
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: [
'components/jquery/jquery.js',
'components/bootstrap/js/tooltip.js',
'components/bootstrap/js/transition.js',
'components/bootstrap/js/alert.js',
'components/bootstrap/js/button.js',
'components/bootstrap/js/collapse.js',
'components/bootstrap/js/dropdown.js',
'components/bootstrap/js/modal.js',
'components/bootstrap/js/popover.js',
'components/bootstrap/js/tab.js',
'phpmyfaq/assets/js/autosave.js',
'phpmyfaq/assets/js/functions.js'
],
dest: 'phpmyfaq/assets/js/phpmyfaq.js'
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
frontend: {
files: { 'phpmyfaq/assets/js/phpmyfaq.min.js': [ '<%= concat.dist.dest %>' ] }
}
},
jshint: {
jshintrc: '.jshintrc',
gruntfile: {
src: 'Gruntfile.js'
},
beforeconcat: [
'phpmyfaq/assets/js/autosave.js',
'phpmyfaq/assets/js/functions.js'
]
},
less: {
development: {
files: {
'phpmyfaq/admin/assets/css/style.css': 'phpmyfaq/admin/assets/less/style.less',
//'phpmyfaq/admin/assets/css/style.rtl.css': 'phpmyfaq/admin/assets/less/style.rtl.less',
'phpmyfaq/assets/template/default/css/style.css': 'phpmyfaq/assets/template/default/less/style.less'
//'phpmyfaq/assets/template/default/css/style.rtl.css': 'phpmyfaq/assets/template/default/less/style.rtl.less'
}
}
},
cssmin: {
add_banner: {
options: {
banner: '<%= banner %>',
keepSpecialComments: 0
},
files: {
'phpmyfaq/admin/assets/css/style.min.css': 'phpmyfaq/admin/assets/css/style.css',
//'phpmyfaq/admin/assets/css/style.rtl.css': 'phpmyfaq/admin/assets/css/style.rtl.css',
'phpmyfaq/assets/template/default/css/style.min.css': ['phpmyfaq/assets/template/default/css/style.css']
//'phpmyfaq/assets/template/default/css/style.rtl.min.css': ['phpmyfaq/assets/template/default/css/style.rtl.css']
}
}
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile'],
options: {
reload: true
}
},
css: {
files: ['phpmyfaq/admin/assets/less/*.less', 'phpmyfaq/assets/template/default/less/*.less'],
tasks: ['less', 'cssmin'],
options: {
livereload: true,
}
}
}
});
// Default task.
grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'less', 'cssmin']);
// Watcher
grunt.event.on('watch', function(action, filepath, target) {
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
});
};