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