]>
Commit | Line | Data |
---|---|---|
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: { | |
12 | inline: false, | |
13 | }, | |
14 | ||
15 | processors: [ | |
16 | require('pixrem')(), | |
17 | require('autoprefixer')({ browsers: 'last 2 versions' }), | |
18 | require('cssnano')(), | |
19 | ], | |
20 | }, | |
21 | src: '<%= buildDir %>/material.css', | |
22 | dest: '<%= buildDir %>/themes/material/css/style.min.css', | |
23 | }, | |
24 | baggy: { | |
25 | options: { | |
26 | map: { | |
27 | inline: false, | |
28 | }, | |
29 | ||
30 | processors: [ | |
31 | require('pixrem')(), | |
32 | require('autoprefixer')({ browsers: 'last 2 versions' }), | |
33 | require('cssnano')(), | |
34 | ], | |
35 | }, | |
36 | src: '<%= buildDir %>/baggy.css', | |
37 | dest: '<%= buildDir %>/themes/baggy/css/style.min.css', | |
38 | }, | |
39 | }, | |
40 | concat: { | |
41 | options: { | |
42 | separator: ';', | |
43 | }, | |
44 | jsMaterial: { | |
45 | src: [ | |
46 | '<%= appDir %>/themes/material/js/init.js', | |
47 | '<%= appDir %>/themes/_global/js/restoreScroll.js', | |
48 | ], | |
49 | dest: '<%= buildDir %>/material.js', | |
50 | }, | |
51 | jsBaggy: { | |
52 | src: [ | |
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', | |
59 | // Save link is no more used for now | |
60 | // '<%= appDir %>/themes/baggy/js/saveLink.js', | |
61 | ], | |
62 | dest: '<%= buildDir %>/baggy.js', | |
63 | }, | |
64 | cssMaterial: { | |
65 | src: [ | |
66 | 'node_modules/materialize-css/bin/materialize.css', | |
67 | '<%= appDir %>/themes/material/css/*.css', | |
68 | ], | |
69 | dest: '<%= buildDir %>/material.css', | |
70 | }, | |
71 | cssBaggy: { | |
72 | src: [ | |
73 | '<%= appDir %>/themes/baggy/css/*.css', | |
74 | ], | |
75 | dest: '<%= buildDir %>/baggy.css', | |
76 | }, | |
77 | }, | |
78 | browserify: { | |
79 | '<%= buildDir %>/material.browser.js': ['<%= buildDir %>/material.js'], | |
80 | '<%= buildDir %>/baggy.browser.js': ['<%= buildDir %>/baggy.js'], | |
81 | }, | |
82 | uglify: { | |
83 | material: { | |
84 | files: { | |
85 | '<%= buildDir %>/themes/material/js/material.min.js': | |
86 | ['<%= buildDir %>/material.browser.js'], | |
87 | }, | |
88 | options: { | |
89 | sourceMap: true, | |
90 | }, | |
91 | }, | |
92 | baggy: { | |
93 | files: { | |
94 | '<%= buildDir %>/themes/baggy/js/baggy.min.js': | |
95 | ['<%= buildDir %>/baggy.browser.js'], | |
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', | |
107 | dest: '<%= buildDir %>', | |
108 | }, | |
109 | annotator: { | |
110 | expand: true, | |
111 | cwd: 'node_modules/annotator/pkg', | |
112 | src: 'annotator.min.js', | |
113 | dest: '<%= buildDir %>/themes/_global/js/', | |
114 | }, | |
115 | }, | |
116 | symlink: { | |
117 | baggyfonts: { | |
118 | files: [ | |
119 | { | |
120 | expand: true, | |
121 | overwrite: true, | |
122 | cwd: '<%= appDir %>/lib/icomoon-bower/', | |
123 | src: 'fonts', | |
124 | dest: '<%= buildDir %>/themes/baggy/', | |
125 | }, | |
126 | { | |
127 | expand: true, | |
128 | overwrite: true, | |
129 | cwd: '<%= appDir %>/lib/bower-pt-sans/fonts', | |
130 | src: '*', | |
131 | dest: '<%= buildDir %>/themes/baggy/fonts/', | |
132 | }, | |
133 | ], | |
134 | }, | |
135 | materialfonts: { | |
136 | files: [ | |
137 | { | |
138 | expand: true, | |
139 | overwrite: true, | |
140 | cwd: '<%= appDir %>/lib/icomoon-bower/', | |
141 | src: 'fonts', | |
142 | dest: '<%= buildDir %>/themes/material/', | |
143 | }, | |
144 | { | |
145 | expand: true, | |
146 | overwrite: true, | |
147 | cwd: 'node_modules/materialize-css/', | |
148 | src: 'font', | |
149 | dest: '<%= buildDir %>/themes/material', | |
150 | }, | |
151 | { | |
152 | expand: true, | |
153 | overwrite: true, | |
154 | cwd: '<%= appDir %>/lib/roboto-fontface/fonts/', | |
155 | src: '*', | |
156 | dest: '<%= buildDir %>/themes/material/fonts/roboto/', | |
157 | }, | |
158 | { | |
159 | expand: true, | |
160 | overwrite: true, | |
161 | cwd: '<%= appDir %>/lib/material-design-icons-iconfont/dist/fonts/', | |
162 | src: '*', | |
163 | dest: '<%= buildDir %>/themes/material/fonts/', | |
164 | }, | |
165 | ], | |
166 | }, | |
167 | pics: { | |
168 | files: [ | |
169 | { | |
170 | expand: true, | |
171 | overwrite: true, | |
172 | cwd: '<%= appDir %>/themes/_global/', | |
173 | src: 'img', | |
174 | dest: '<%= buildDir %>/themes/_global/', | |
175 | }, | |
176 | ], | |
177 | }, | |
178 | }, | |
179 | clean: { | |
180 | css: { | |
181 | src: ['<%= buildDir %>/**/*.css'], | |
182 | }, | |
183 | js: { | |
184 | src: ['<%= buildDir %>/**/*.js', '<%= buildDir %>/**/*.map'], | |
185 | }, | |
186 | all: { | |
187 | src: ['./<%= buildDir %>'], | |
188 | }, | |
189 | }, | |
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 | ); | |
215 | }; |