]>
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', |
a8d5aa1c | 48 | 'node_modules/jquery.tinydot/src/jquery.tinydot.js', |
5ecdfcd0 | 49 | ], |
0743287f | 50 | dest: '<%= buildDir %>/material.js', |
5ecdfcd0 TC |
51 | }, |
52 | jsBaggy: { | |
53 | src: [ | |
5ecdfcd0 TC |
54 | '<%= appDir %>/themes/baggy/js/init.js', |
55 | '<%= appDir %>/themes/_global/js/restoreScroll.js', | |
56 | '<%= appDir %>/themes/baggy/js/autoClose.js', | |
57 | '<%= appDir %>/themes/baggy/js/autoCompleteTags.js', | |
58 | '<%= appDir %>/themes/baggy/js/closeMessage.js', | |
59 | '<%= appDir %>/themes/baggy/js/popupForm.js', | |
0743287f TC |
60 | // Save link is no more used for now |
61 | // '<%= appDir %>/themes/baggy/js/saveLink.js', | |
5ecdfcd0 | 62 | ], |
0743287f | 63 | dest: '<%= buildDir %>/baggy.js', |
5ecdfcd0 TC |
64 | }, |
65 | cssMaterial: { | |
66 | src: [ | |
67 | 'node_modules/materialize-css/bin/materialize.css', | |
0743287f | 68 | '<%= appDir %>/themes/material/css/*.css', |
5ecdfcd0 | 69 | ], |
0743287f | 70 | dest: '<%= buildDir %>/material.css', |
5ecdfcd0 TC |
71 | }, |
72 | cssBaggy: { | |
73 | src: [ | |
0743287f | 74 | '<%= appDir %>/themes/baggy/css/*.css', |
5ecdfcd0 | 75 | ], |
0743287f TC |
76 | dest: '<%= buildDir %>/baggy.css', |
77 | }, | |
5ecdfcd0 TC |
78 | }, |
79 | browserify: { | |
80 | '<%= buildDir %>/material.browser.js': ['<%= buildDir %>/material.js'], | |
0743287f | 81 | '<%= buildDir %>/baggy.browser.js': ['<%= buildDir %>/baggy.js'], |
5ecdfcd0 TC |
82 | }, |
83 | uglify: { | |
84 | material: { | |
85 | files: { | |
86 | '<%= buildDir %>/themes/material/js/material.min.js': | |
0743287f | 87 | ['<%= buildDir %>/material.browser.js'], |
5ecdfcd0 TC |
88 | }, |
89 | options: { | |
90 | sourceMap: true, | |
91 | }, | |
92 | }, | |
93 | baggy: { | |
94 | files: { | |
95 | '<%= buildDir %>/themes/baggy/js/baggy.min.js': | |
0743287f | 96 | ['<%= buildDir %>/baggy.browser.js'], |
5ecdfcd0 TC |
97 | }, |
98 | options: { | |
99 | sourceMap: true, | |
100 | }, | |
101 | }, | |
102 | }, | |
103 | copy: { | |
104 | pickerjs: { | |
105 | expand: true, | |
106 | cwd: 'node_modules/pickadate/lib', | |
107 | src: 'picker.js', | |
0743287f | 108 | dest: '<%= buildDir %>', |
5ecdfcd0 TC |
109 | }, |
110 | annotator: { | |
111 | expand: true, | |
112 | cwd: 'node_modules/annotator/pkg', | |
113 | src: 'annotator.min.js', | |
0743287f TC |
114 | dest: '<%= buildDir %>/themes/_global/js/', |
115 | }, | |
5ecdfcd0 TC |
116 | }, |
117 | symlink: { | |
118 | baggyfonts: { | |
119 | files: [ | |
120 | { | |
121 | expand: true, | |
122 | overwrite: true, | |
0743287f TC |
123 | cwd: '<%= appDir %>/lib/icomoon-bower/', |
124 | src: 'fonts', | |
125 | dest: '<%= buildDir %>/themes/baggy/', | |
5ecdfcd0 TC |
126 | }, |
127 | { | |
128 | expand: true, | |
129 | overwrite: true, | |
0743287f TC |
130 | cwd: '<%= appDir %>/lib/bower-pt-sans/fonts', |
131 | src: '*', | |
132 | dest: '<%= buildDir %>/themes/baggy/fonts/', | |
133 | }, | |
134 | ], | |
5ecdfcd0 TC |
135 | }, |
136 | materialfonts: { | |
137 | files: [ | |
138 | { | |
139 | expand: true, | |
140 | overwrite: true, | |
0743287f TC |
141 | cwd: '<%= appDir %>/lib/icomoon-bower/', |
142 | src: 'fonts', | |
143 | dest: '<%= buildDir %>/themes/material/', | |
5ecdfcd0 TC |
144 | }, |
145 | { | |
146 | expand: true, | |
147 | overwrite: true, | |
0743287f TC |
148 | cwd: 'node_modules/materialize-css/', |
149 | src: 'font', | |
150 | dest: '<%= buildDir %>/themes/material', | |
5ecdfcd0 TC |
151 | }, |
152 | { | |
153 | expand: true, | |
154 | overwrite: true, | |
0743287f TC |
155 | cwd: '<%= appDir %>/lib/roboto-fontface/fonts/', |
156 | src: '*', | |
157 | dest: '<%= buildDir %>/themes/material/fonts/roboto/', | |
5ecdfcd0 TC |
158 | }, |
159 | { | |
160 | expand: true, | |
161 | overwrite: true, | |
dafc5cf9 | 162 | cwd: '<%= appDir %>/lib/material-design-icons-iconfont/dist/fonts/', |
0743287f TC |
163 | src: '*', |
164 | dest: '<%= buildDir %>/themes/material/fonts/', | |
165 | }, | |
166 | ], | |
5ecdfcd0 TC |
167 | }, |
168 | pics: { | |
169 | files: [ | |
170 | { | |
171 | expand: true, | |
172 | overwrite: true, | |
173 | cwd: '<%= appDir %>/themes/_global/', | |
174 | src: 'img', | |
0743287f TC |
175 | dest: '<%= buildDir %>/themes/_global/', |
176 | }, | |
177 | ], | |
178 | }, | |
5ecdfcd0 TC |
179 | }, |
180 | clean: { | |
181 | css: { | |
0743287f | 182 | src: ['<%= buildDir %>/**/*.css'], |
5ecdfcd0 TC |
183 | }, |
184 | js: { | |
0743287f | 185 | src: ['<%= buildDir %>/**/*.js', '<%= buildDir %>/**/*.map'], |
5ecdfcd0 TC |
186 | }, |
187 | all: { | |
0743287f TC |
188 | src: ['./<%= buildDir %>'], |
189 | }, | |
190 | }, | |
5ecdfcd0 TC |
191 | }); |
192 | ||
193 | grunt.registerTask( | |
194 | 'fonts', | |
195 | 'Install fonts', | |
196 | ['symlink:baggyfonts', 'symlink:materialfonts'] | |
197 | ); | |
198 | ||
199 | grunt.registerTask( | |
200 | 'js', | |
201 | 'Build and install js files', | |
202 | ['clean:js', 'copy:pickerjs', 'concat:jsMaterial', 'concat:jsBaggy', 'browserify', 'uglify'] | |
203 | ); | |
204 | ||
205 | grunt.registerTask( | |
206 | 'default', | |
207 | 'Build and install everything', | |
208 | ['clean', 'copy:pickerjs', 'concat', 'browserify', 'uglify', 'postcss', 'symlink'] | |
209 | ); | |
210 | ||
211 | grunt.registerTask( | |
212 | 'css', | |
213 | 'Compiles the stylesheets.', | |
214 | ['clean:css', 'concat:cssMaterial', 'concat:cssBaggy', 'postcss'] | |
215 | ); | |
0743287f | 216 | }; |