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