[TASK] Update autosize to 3.0.13
[Packages/TYPO3.CMS.git] / Build / Gruntfile.js
1 /*
2 * This file is part of the TYPO3 CMS project.
3 *
4 * It is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License, either version 2
6 * of the License, or any later version.
7 *
8 * For the full copyright and license information, please read the
9 * LICENSE.txt file that was distributed with this source code.
10 *
11 * The TYPO3 project - inspiring people to share!
12 */
13
14 module.exports = function(grunt) {
15
16 // Project configuration.
17 grunt.initConfig({
18 pkg: grunt.file.readJSON('package.json'),
19 banner: '/*!\n' +
20 ' * This file is part of the TYPO3 CMS project.\n' +
21 ' *\n' +
22 ' * It is free software; you can redistribute it and/or modify it under\n' +
23 ' * the terms of the GNU General Public License, either version 2\n' +
24 ' * of the License, or any later version.\n' +
25 ' *\n' +
26 ' * For the full copyright and license information, please read the\n' +
27 ' * LICENSE.txt file that was distributed with this source code.\n' +
28 ' *\n' +
29 ' * The TYPO3 project - inspiring people to share!\n' +
30 ' */\n',
31 paths: {
32 resources : 'Resources/',
33 less : '<%= paths.resources %>Public/Less/',
34 root : '../',
35 sysext : '<%= paths.root %>typo3/sysext/',
36 t3skin : '<%= paths.sysext %>t3skin/Resources/',
37 backend : '<%= paths.sysext %>backend/Resources/',
38 core : '<%= paths.sysext %>core/Resources/',
39 flags : 'bower_components/region-flags/svg/',
40 t3icons : 'bower_components/wmdbsystems-typo3-icons/dist/'
41 },
42 less: {
43 t3skin: {
44 options: {
45 banner: '<%= banner %>',
46 outputSourceFiles: true
47 },
48 files: {
49 "<%= paths.t3skin %>Public/Css/backend.css": "<%= paths.less %>backend.less"
50 }
51 }
52 },
53 postcss: {
54 options: {
55 map: false,
56 processors: [
57 require('autoprefixer')({ // add vendor prefixes
58 browsers: [
59 'Last 2 versions',
60 'Firefox ESR',
61 'IE 9'
62 ]
63 })
64 ]
65 },
66 t3skin: {
67 src: '<%= paths.t3skin %>Public/Css/*.css'
68 }
69 },
70 watch: {
71 less: {
72 files: '<%= paths.less %>**/*.less',
73 tasks: 'css'
74 }
75 },
76 copy: {
77 options: {
78 punctuation: ''
79 },
80 core_icons: {
81 files: [{
82 expand: true,
83 cwd: '<%= paths.t3icons %>',
84 src: ['**/*.svg', '!module/*'],
85 dest: '<%= paths.sysext %>core/Resources/Public/Icons/T3Icons/',
86 ext: '.svg'
87 }]
88 },
89 module_icons: {
90 files: [
91 { dest: '<%= paths.sysext %>about/Resources/Public/Icons/module-about.svg', src: '<%= paths.t3icons %>module/module-about.svg' },
92 { dest: '<%= paths.sysext %>aboutmodules/Resources/Public/Icons/module-aboutmodules.svg', src: '<%= paths.t3icons %>module/module-aboutmodules.svg' },
93 { dest: '<%= paths.sysext %>belog/Resources/Public/Icons/module-belog.svg', src: '<%= paths.t3icons %>module/module-belog.svg' },
94 { dest: '<%= paths.sysext %>beuser/Resources/Public/Icons/module-beuser.svg', src: '<%= paths.t3icons %>module/module-beuser.svg' },
95 { dest: '<%= paths.sysext %>lowlevel/Resources/Public/Icons/module-config.svg', src: '<%= paths.t3icons %>module/module-config.svg' },
96 { dest: '<%= paths.sysext %>cshmanual/Resources/Public/Icons/module-cshmanual.svg', src: '<%= paths.t3icons %>module/module-cshmanual.svg' },
97 { dest: '<%= paths.sysext %>dbal/Resources/Public/Icons/module-dbal.svg', src: '<%= paths.t3icons %>module/module-dbal.svg' },
98 { dest: '<%= paths.sysext %>lowlevel/Resources/Public/Icons/module-dbint.svg', src: '<%= paths.t3icons %>module/module-dbint.svg' },
99 { dest: '<%= paths.sysext %>documentation/Resources/Public/Icons/module-documentation.svg', src: '<%= paths.t3icons %>module/module-documentation.svg' },
100 { dest: '<%= paths.sysext %>extensionmanager/Resources/Public/Icons/module-extensionmanager.svg', src: '<%= paths.t3icons %>module/module-extensionmanager.svg' },
101 { dest: '<%= paths.sysext %>filelist/Resources/Public/Icons/module-filelist.svg', src: '<%= paths.t3icons %>module/module-filelist.svg' },
102 { dest: '<%= paths.sysext %>func/Resources/Public/Icons/module-func.svg', src: '<%= paths.t3icons %>module/module-func.svg' },
103 { dest: '<%= paths.sysext %>indexed_search/Resources/Public/Icons/module-indexed_search.svg', src: '<%= paths.t3icons %>module/module-indexed_search.svg' },
104 { dest: '<%= paths.sysext %>info/Resources/Public/Icons/module-info.svg', src: '<%= paths.t3icons %>module/module-info.svg' },
105 { dest: '<%= paths.sysext %>install/Resources/Public/Icons/module-install.svg', src: '<%= paths.t3icons %>module/module-install.svg' },
106 { dest: '<%= paths.sysext %>lang/Resources/Public/Icons/module-lang.svg', src: '<%= paths.t3icons %>module/module-lang.svg' },
107 { dest: '<%= paths.sysext %>recordlist/Resources/Public/Icons/module-list.svg', src: '<%= paths.t3icons %>module/module-list.svg' },
108 { dest: '<%= paths.sysext %>backend/Resources/Public/Icons/module-page.svg', src: '<%= paths.t3icons %>module/module-page.svg' },
109 { dest: '<%= paths.sysext %>beuser/Resources/Public/Icons/module-permission.svg', src: '<%= paths.t3icons %>module/module-permission.svg' },
110 { dest: '<%= paths.sysext %>recycler/Resources/Public/Icons/module-recycler.svg', src: '<%= paths.t3icons %>module/module-recycler.svg' },
111 { dest: '<%= paths.sysext %>reports/Resources/Public/Icons/module-reports.svg', src: '<%= paths.t3icons %>module/module-reports.svg' },
112 { dest: '<%= paths.sysext %>scheduler/Resources/Public/Icons/module-scheduler.svg', src: '<%= paths.t3icons %>module/module-scheduler.svg' },
113 { dest: '<%= paths.sysext %>setup/Resources/Public/Icons/module-setup.svg', src: '<%= paths.t3icons %>module/module-setup.svg' },
114 { dest: '<%= paths.sysext %>taskcenter/Resources/Public/Icons/module-taskcenter.svg', src: '<%= paths.t3icons %>module/module-taskcenter.svg' },
115 { dest: '<%= paths.sysext %>tstemplate/Resources/Public/Icons/module-tstemplate.svg', src: '<%= paths.t3icons %>module/module-tstemplate.svg' },
116 { dest: '<%= paths.sysext %>version/Resources/Public/Icons/module-version.svg', src: '<%= paths.t3icons %>module/module-version.svg' },
117 { dest: '<%= paths.sysext %>viewpage/Resources/Public/Icons/module-viewpage.svg', src: '<%= paths.t3icons %>module/module-viewpage.svg' },
118 { dest: '<%= paths.sysext %>workspaces/Resources/Public/Icons/module-workspaces.svg', src: '<%= paths.t3icons %>module/module-workspaces.svg' }
119 ]
120 }
121 },
122 bowercopy: {
123 options: {
124 clean: false,
125 report: false,
126 runBower: false,
127 srcPrefix: "bower_components/"
128 },
129 all: {
130 options: {
131 destPrefix: "<%= paths.core %>Public/JavaScript/Contrib"
132 },
133 files: {
134 'nprogress.js': 'nprogress/nprogress.js',
135 'jquery.dataTables.js': 'datatables/media/js/jquery.dataTables.min.js',
136 'require.js': 'requirejs/require.js',
137 'moment.js': 'moment/moment.js',
138 'moment-timezone.js': 'moment-timezone/builds/moment-timezone-with-data.min.js',
139 'cropper.min.js': 'cropper/dist/cropper.min.js',
140 'imagesloaded.pkgd.min.js': 'imagesloaded/imagesloaded.pkgd.min.js',
141 'bootstrap-datetimepicker.js': 'eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js',
142 'autosize.js': 'autosize/dist/autosize.min.js',
143 'placeholders.jquery.min.js': 'Placeholders.js/dist/placeholders.jquery.min.js',
144 'taboverride.min.js': 'taboverride/build/output/taboverride.min.js',
145 'bootstrap-slider.min.js': 'seiyria-bootstrap-slider/dist/bootstrap-slider.min.js',
146 /* disabled until autocomplete groupBy is fixed by the author
147 see https://github.com/devbridge/jQuery-Autocomplete/pull/387
148 'jquery.autocomplete.js': 'devbridge-autocomplete/src/jquery.autocomplete.js',
149 */
150
151 /**
152 * copy needed parts of jquery
153 */
154 'jquery/jquery-2.1.4.js': 'jquery/dist/jquery.js',
155 'jquery/jquery-2.1.4.min.js': 'jquery/dist/jquery.min.js',
156 /**
157 * copy needed parts of jquery-ui
158 */
159 'jquery-ui/core.js': 'jquery-ui/ui/core.js',
160 'jquery-ui/draggable.js': 'jquery-ui/ui/draggable.js',
161 'jquery-ui/droppable.js': 'jquery-ui/ui/droppable.js',
162 'jquery-ui/mouse.js': 'jquery-ui/ui/mouse.js',
163 'jquery-ui/position.js': 'jquery-ui/ui/position.js',
164 'jquery-ui/resizable.js': 'jquery-ui/ui/resizable.js',
165 'jquery-ui/selectable.js': 'jquery-ui/ui/selectable.js',
166 'jquery-ui/sortable.js': 'jquery-ui/ui/sortable.js',
167 'jquery-ui/widget.js': 'jquery-ui/ui/widget.js'
168 }
169 }
170 },
171 uglify: {
172 thirdparty: {
173 files: {
174 "<%= paths.core %>Public/JavaScript/Contrib/require.js": ["<%= paths.core %>Public/JavaScript/Contrib/require.js"],
175 "<%= paths.core %>Public/JavaScript/Contrib/moment.js": ["<%= paths.core %>Public/JavaScript/Contrib/moment.js"],
176 "<%= paths.core %>Public/JavaScript/Contrib/nprogress.js": ["<%= paths.core %>Public/JavaScript/Contrib/nprogress.js"],
177 "<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/core.js": ["<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/core.js"],
178 "<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/draggable.js": ["<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/draggable.js"],
179 "<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/droppable.js": ["<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/droppable.js"],
180 "<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/mouse.js": ["<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/mouse.js"],
181 "<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/position.js": ["<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/position.js"],
182 "<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/resizable.js": ["<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/resizable.js"],
183 "<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/selectable.js": ["<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/selectable.js"],
184 "<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/sortable.js": ["<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/sortable.js"],
185 "<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/widget.js": ["<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/widget.js"]
186 }
187 }
188 },
189 svgmin: {
190 options: {
191 plugins: [
192 { removeViewBox: false }
193 ]
194 },
195 // Flags
196 flags: {
197 files: [{
198 expand: true,
199 cwd: '<%= paths.flags %>',
200 src: '*.svg',
201 dest: '<%= paths.sysext %>core/Resources/Public/Icons/Flags/SVG/',
202 ext: '.svg',
203 extDot: 'first'
204 }]
205 }
206 }
207 });
208
209 // Register tasks
210 grunt.loadNpmTasks('grunt-contrib-less');
211 grunt.loadNpmTasks('grunt-contrib-watch');
212 grunt.loadNpmTasks('grunt-bowercopy');
213 grunt.loadNpmTasks('grunt-npm-install');
214 grunt.loadNpmTasks('grunt-bower-just-install');
215 grunt.loadNpmTasks('grunt-contrib-uglify');
216 grunt.loadNpmTasks('grunt-svgmin');
217 grunt.loadNpmTasks('grunt-postcss');
218 grunt.loadNpmTasks('grunt-copy');
219
220 /**
221 * grunt default task
222 *
223 * call "$ grunt"
224 *
225 * this will trigger the CSS build
226 */
227 grunt.registerTask('default', ['css']);
228
229 /**
230 * grunt css task
231 *
232 * call "$ grunt css"
233 *
234 * this task does the following things:
235 * - less
236 * - postcss
237 */
238 grunt.registerTask('css', ['less', 'postcss']);
239
240 /**
241 * grunt update task
242 *
243 * call "$ grunt update"
244 *
245 * this task does the following things:
246 * - npm install
247 * - bower install
248 * - copy some bower components to a specific destinations because they need to be included via PHP
249 */
250 grunt.registerTask('update', ['npm-install', 'bower_install', 'bowercopy']);
251
252 /**
253 * grunt build task
254 *
255 * call "$ grunt build"
256 *
257 * this task does the following things:
258 * - execute update task
259 * - execute copy task
260 * - compile less files
261 * - uglify js files
262 * - minifies svg files
263 */
264 grunt.registerTask('build', ['update', 'copy', 'css', 'uglify', 'svgmin']);
265 };