]> git.immae.eu Git - github/wallabag/wallabag.git/blame - Gruntfile.js
remove autocomplete and bring fonts through npm
[github/wallabag/wallabag.git] / Gruntfile.js
CommitLineData
5ecdfcd0
TC
1module.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"]
8f234d01
TC
70 }], ["browserify-shim", {
71 "jquery": {
72 "exports": "$"
73 },
74 "materialize": "materialize",
75 "jquery-ui": {
76 "depends": "jquery",
77 "exports": null
78 }
79 }]
c146f694
TC
80 ],
81 browserifyOptions: {
82 browser: {
83 "jQuery": "./node_modules/jquery/dist/jquery.js",
8f234d01
TC
84 "jquery.tinydot": "./node_modules/jquery.tinydot/src/jquery.tinydot.js",
85 "jquery.ui": "./node_modules/jquery-ui-browserify/dist/jquery-ui.js"
c146f694
TC
86 }
87 }
88 }
89
5ecdfcd0
TC
90 },
91 uglify: {
92 material: {
93 files: {
94 '<%= buildDir %>/themes/material/js/material.min.js':
0743287f 95 ['<%= buildDir %>/material.browser.js'],
5ecdfcd0
TC
96 },
97 options: {
98 sourceMap: true,
99 },
100 },
101 baggy: {
102 files: {
103 '<%= buildDir %>/themes/baggy/js/baggy.min.js':
0743287f 104 ['<%= buildDir %>/baggy.browser.js'],
5ecdfcd0
TC
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',
0743287f 116 dest: '<%= buildDir %>',
5ecdfcd0
TC
117 },
118 annotator: {
119 expand: true,
120 cwd: 'node_modules/annotator/pkg',
121 src: 'annotator.min.js',
0743287f
TC
122 dest: '<%= buildDir %>/themes/_global/js/',
123 },
5ecdfcd0
TC
124 },
125 symlink: {
126 baggyfonts: {
127 files: [
128 {
129 expand: true,
130 overwrite: true,
0743287f
TC
131 cwd: '<%= appDir %>/lib/icomoon-bower/',
132 src: 'fonts',
133 dest: '<%= buildDir %>/themes/baggy/',
5ecdfcd0
TC
134 },
135 {
136 expand: true,
137 overwrite: true,
0743287f
TC
138 cwd: '<%= appDir %>/lib/bower-pt-sans/fonts',
139 src: '*',
140 dest: '<%= buildDir %>/themes/baggy/fonts/',
141 },
142 ],
5ecdfcd0
TC
143 },
144 materialfonts: {
145 files: [
146 {
147 expand: true,
148 overwrite: true,
0743287f
TC
149 cwd: '<%= appDir %>/lib/icomoon-bower/',
150 src: 'fonts',
151 dest: '<%= buildDir %>/themes/material/',
5ecdfcd0
TC
152 },
153 {
154 expand: true,
155 overwrite: true,
0743287f
TC
156 cwd: 'node_modules/materialize-css/',
157 src: 'font',
158 dest: '<%= buildDir %>/themes/material',
5ecdfcd0
TC
159 },
160 {
161 expand: true,
162 overwrite: true,
0743287f
TC
163 cwd: '<%= appDir %>/lib/roboto-fontface/fonts/',
164 src: '*',
165 dest: '<%= buildDir %>/themes/material/fonts/roboto/',
5ecdfcd0
TC
166 },
167 {
168 expand: true,
169 overwrite: true,
dafc5cf9 170 cwd: '<%= appDir %>/lib/material-design-icons-iconfont/dist/fonts/',
0743287f
TC
171 src: '*',
172 dest: '<%= buildDir %>/themes/material/fonts/',
173 },
174 ],
5ecdfcd0
TC
175 },
176 pics: {
177 files: [
178 {
179 expand: true,
180 overwrite: true,
181 cwd: '<%= appDir %>/themes/_global/',
182 src: 'img',
0743287f
TC
183 dest: '<%= buildDir %>/themes/_global/',
184 },
185 ],
186 },
5ecdfcd0
TC
187 },
188 clean: {
189 css: {
0743287f 190 src: ['<%= buildDir %>/**/*.css'],
5ecdfcd0
TC
191 },
192 js: {
0743287f 193 src: ['<%= buildDir %>/**/*.js', '<%= buildDir %>/**/*.map'],
5ecdfcd0
TC
194 },
195 all: {
0743287f
TC
196 src: ['./<%= buildDir %>'],
197 },
198 },
5ecdfcd0
TC
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',
c146f694 210 ['clean:js', 'copy:pickerjs', 'browserify', 'uglify']
5ecdfcd0
TC
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 );
0743287f 224};