]>
Commit | Line | Data |
---|---|---|
5ecdfcd0 TC |
1 | module.exports = function (grunt) { |
2 | require('load-grunt-tasks')(grunt); | |
3 | ||
4 | grunt.initConfig({ | |
5 | appDir: 'app/Resources/static', | |
6 | buildDir: 'web/bundles/wallabagcore', | |
7 | ||
8 | postcss: { | |
9 | material: { | |
10 | options: { | |
11 | map: { | |
0743287f | 12 | inline: false, |
5ecdfcd0 TC |
13 | }, |
14 | ||
15 | processors: [ | |
16 | require('pixrem')(), | |
0743287f TC |
17 | require('autoprefixer')({ browsers: 'last 2 versions' }), |
18 | require('cssnano')(), | |
19 | ], | |
5ecdfcd0 TC |
20 | }, |
21 | src: '<%= buildDir %>/material.css', | |
0743287f | 22 | dest: '<%= buildDir %>/themes/material/css/style.min.css', |
5ecdfcd0 TC |
23 | }, |
24 | baggy: { | |
25 | options: { | |
26 | map: { | |
0743287f | 27 | inline: false, |
5ecdfcd0 TC |
28 | }, |
29 | ||
30 | processors: [ | |
31 | require('pixrem')(), | |
0743287f TC |
32 | require('autoprefixer')({ browsers: 'last 2 versions' }), |
33 | require('cssnano')(), | |
34 | ], | |
5ecdfcd0 TC |
35 | }, |
36 | src: '<%= buildDir %>/baggy.css', | |
0743287f TC |
37 | dest: '<%= buildDir %>/themes/baggy/css/style.min.css', |
38 | }, | |
5ecdfcd0 TC |
39 | }, |
40 | concat: { | |
41 | options: { | |
0743287f | 42 | separator: ';', |
5ecdfcd0 TC |
43 | }, |
44 | jsMaterial: { | |
45 | src: [ | |
0743287f | 46 | '<%= appDir %>/themes/material/js/init.js', |
5ecdfcd0 | 47 | '<%= appDir %>/themes/_global/js/restoreScroll.js', |
5ecdfcd0 | 48 | ], |
0743287f | 49 | dest: '<%= buildDir %>/material.js', |
5ecdfcd0 TC |
50 | }, |
51 | jsBaggy: { | |
52 | src: [ | |
5ecdfcd0 TC |
53 | '<%= appDir %>/themes/baggy/js/init.js', |
54 | '<%= appDir %>/themes/_global/js/restoreScroll.js', | |
55 | '<%= appDir %>/themes/baggy/js/autoClose.js', | |
56 | '<%= appDir %>/themes/baggy/js/autoCompleteTags.js', | |
57 | '<%= appDir %>/themes/baggy/js/closeMessage.js', | |
58 | '<%= appDir %>/themes/baggy/js/popupForm.js', | |
0743287f TC |
59 | // Save link is no more used for now |
60 | // '<%= appDir %>/themes/baggy/js/saveLink.js', | |
5ecdfcd0 | 61 | ], |
0743287f | 62 | dest: '<%= buildDir %>/baggy.js', |
5ecdfcd0 TC |
63 | }, |
64 | cssMaterial: { | |
65 | src: [ | |
66 | 'node_modules/materialize-css/bin/materialize.css', | |
0743287f | 67 | '<%= appDir %>/themes/material/css/*.css', |
5ecdfcd0 | 68 | ], |
0743287f | 69 | dest: '<%= buildDir %>/material.css', |
5ecdfcd0 TC |
70 | }, |
71 | cssBaggy: { | |
72 | src: [ | |
0743287f | 73 | '<%= appDir %>/themes/baggy/css/*.css', |
5ecdfcd0 | 74 | ], |
0743287f TC |
75 | dest: '<%= buildDir %>/baggy.css', |
76 | }, | |
5ecdfcd0 TC |
77 | }, |
78 | browserify: { | |
79 | '<%= buildDir %>/material.browser.js': ['<%= buildDir %>/material.js'], | |
0743287f | 80 | '<%= buildDir %>/baggy.browser.js': ['<%= buildDir %>/baggy.js'], |
5ecdfcd0 TC |
81 | }, |
82 | uglify: { | |
83 | material: { | |
84 | files: { | |
85 | '<%= buildDir %>/themes/material/js/material.min.js': | |
0743287f | 86 | ['<%= buildDir %>/material.browser.js'], |
5ecdfcd0 TC |
87 | }, |
88 | options: { | |
89 | sourceMap: true, | |
90 | }, | |
91 | }, | |
92 | baggy: { | |
93 | files: { | |
94 | '<%= buildDir %>/themes/baggy/js/baggy.min.js': | |
0743287f | 95 | ['<%= buildDir %>/baggy.browser.js'], |
5ecdfcd0 TC |
96 | }, |
97 | options: { | |
98 | sourceMap: true, | |
99 | }, | |
100 | }, | |
101 | }, | |
102 | copy: { | |
103 | pickerjs: { | |
104 | expand: true, | |
105 | cwd: 'node_modules/pickadate/lib', | |
106 | src: 'picker.js', | |
0743287f | 107 | dest: '<%= buildDir %>', |
5ecdfcd0 TC |
108 | }, |
109 | annotator: { | |
110 | expand: true, | |
111 | cwd: 'node_modules/annotator/pkg', | |
112 | src: 'annotator.min.js', | |
0743287f TC |
113 | dest: '<%= buildDir %>/themes/_global/js/', |
114 | }, | |
5ecdfcd0 TC |
115 | }, |
116 | symlink: { | |
117 | baggyfonts: { | |
118 | files: [ | |
119 | { | |
120 | expand: true, | |
121 | overwrite: true, | |
0743287f TC |
122 | cwd: '<%= appDir %>/lib/icomoon-bower/', |
123 | src: 'fonts', | |
124 | dest: '<%= buildDir %>/themes/baggy/', | |
5ecdfcd0 TC |
125 | }, |
126 | { | |
127 | expand: true, | |
128 | overwrite: true, | |
0743287f TC |
129 | cwd: '<%= appDir %>/lib/bower-pt-sans/fonts', |
130 | src: '*', | |
131 | dest: '<%= buildDir %>/themes/baggy/fonts/', | |
132 | }, | |
133 | ], | |
5ecdfcd0 TC |
134 | }, |
135 | materialfonts: { | |
136 | files: [ | |
137 | { | |
138 | expand: true, | |
139 | overwrite: true, | |
0743287f TC |
140 | cwd: '<%= appDir %>/lib/icomoon-bower/', |
141 | src: 'fonts', | |
142 | dest: '<%= buildDir %>/themes/material/', | |
5ecdfcd0 TC |
143 | }, |
144 | { | |
145 | expand: true, | |
146 | overwrite: true, | |
0743287f TC |
147 | cwd: 'node_modules/materialize-css/', |
148 | src: 'font', | |
149 | dest: '<%= buildDir %>/themes/material', | |
5ecdfcd0 TC |
150 | }, |
151 | { | |
152 | expand: true, | |
153 | overwrite: true, | |
0743287f TC |
154 | cwd: '<%= appDir %>/lib/roboto-fontface/fonts/', |
155 | src: '*', | |
156 | dest: '<%= buildDir %>/themes/material/fonts/roboto/', | |
5ecdfcd0 TC |
157 | }, |
158 | { | |
159 | expand: true, | |
160 | overwrite: true, | |
dafc5cf9 | 161 | cwd: '<%= appDir %>/lib/material-design-icons-iconfont/dist/fonts/', |
0743287f TC |
162 | src: '*', |
163 | dest: '<%= buildDir %>/themes/material/fonts/', | |
164 | }, | |
165 | ], | |
5ecdfcd0 TC |
166 | }, |
167 | pics: { | |
168 | files: [ | |
169 | { | |
170 | expand: true, | |
171 | overwrite: true, | |
172 | cwd: '<%= appDir %>/themes/_global/', | |
173 | src: 'img', | |
0743287f TC |
174 | dest: '<%= buildDir %>/themes/_global/', |
175 | }, | |
176 | ], | |
177 | }, | |
5ecdfcd0 TC |
178 | }, |
179 | clean: { | |
180 | css: { | |
0743287f | 181 | src: ['<%= buildDir %>/**/*.css'], |
5ecdfcd0 TC |
182 | }, |
183 | js: { | |
0743287f | 184 | src: ['<%= buildDir %>/**/*.js', '<%= buildDir %>/**/*.map'], |
5ecdfcd0 TC |
185 | }, |
186 | all: { | |
0743287f TC |
187 | src: ['./<%= buildDir %>'], |
188 | }, | |
189 | }, | |
5ecdfcd0 TC |
190 | }); |
191 | ||
192 | grunt.registerTask( | |
193 | 'fonts', | |
194 | 'Install fonts', | |
195 | ['symlink:baggyfonts', 'symlink:materialfonts'] | |
196 | ); | |
197 | ||
198 | grunt.registerTask( | |
199 | 'js', | |
200 | 'Build and install js files', | |
201 | ['clean:js', 'copy:pickerjs', 'concat:jsMaterial', 'concat:jsBaggy', 'browserify', 'uglify'] | |
202 | ); | |
203 | ||
204 | grunt.registerTask( | |
205 | 'default', | |
206 | 'Build and install everything', | |
207 | ['clean', 'copy:pickerjs', 'concat', 'browserify', 'uglify', 'postcss', 'symlink'] | |
208 | ); | |
209 | ||
210 | grunt.registerTask( | |
211 | 'css', | |
212 | 'Compiles the stylesheets.', | |
213 | ['clean:css', 'concat:cssMaterial', 'concat:cssBaggy', 'postcss'] | |
214 | ); | |
0743287f | 215 | }; |