]> git.immae.eu Git - github/wallabag/wallabag.git/blob - Gruntfile.js
8dc5b83bdb3a8fd74d9298c6064085d7338687e4
[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 jsMaterial: {
45 src: [
46 '<%= appDir %>/themes/material/js/init.js',
47 '<%= appDir %>/themes/_global/js/restoreScroll.js',
48 'node_modules/jquery.tinydot/src/jquery.tinydot.js',
49 ],
50 dest: '<%= buildDir %>/material.js',
51 },
52 jsBaggy: {
53 src: [
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',
60 // Save link is no more used for now
61 // '<%= appDir %>/themes/baggy/js/saveLink.js',
62 ],
63 dest: '<%= buildDir %>/baggy.js',
64 },
65 cssMaterial: {
66 src: [
67 'node_modules/materialize-css/bin/materialize.css',
68 '<%= appDir %>/themes/material/css/*.css',
69 ],
70 dest: '<%= buildDir %>/material.css',
71 },
72 cssBaggy: {
73 src: [
74 '<%= appDir %>/themes/baggy/css/*.css',
75 ],
76 dest: '<%= buildDir %>/baggy.css',
77 },
78 },
79 browserify: {
80 '<%= buildDir %>/material.browser.js': ['<%= buildDir %>/material.js'],
81 '<%= buildDir %>/baggy.browser.js': ['<%= buildDir %>/baggy.js'],
82 },
83 uglify: {
84 material: {
85 files: {
86 '<%= buildDir %>/themes/material/js/material.min.js':
87 ['<%= buildDir %>/material.browser.js'],
88 },
89 options: {
90 sourceMap: true,
91 },
92 },
93 baggy: {
94 files: {
95 '<%= buildDir %>/themes/baggy/js/baggy.min.js':
96 ['<%= buildDir %>/baggy.browser.js'],
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',
108 dest: '<%= buildDir %>',
109 },
110 annotator: {
111 expand: true,
112 cwd: 'node_modules/annotator/pkg',
113 src: 'annotator.min.js',
114 dest: '<%= buildDir %>/themes/_global/js/',
115 },
116 },
117 symlink: {
118 baggyfonts: {
119 files: [
120 {
121 expand: true,
122 overwrite: true,
123 cwd: '<%= appDir %>/lib/icomoon-bower/',
124 src: 'fonts',
125 dest: '<%= buildDir %>/themes/baggy/',
126 },
127 {
128 expand: true,
129 overwrite: true,
130 cwd: '<%= appDir %>/lib/bower-pt-sans/fonts',
131 src: '*',
132 dest: '<%= buildDir %>/themes/baggy/fonts/',
133 },
134 ],
135 },
136 materialfonts: {
137 files: [
138 {
139 expand: true,
140 overwrite: true,
141 cwd: '<%= appDir %>/lib/icomoon-bower/',
142 src: 'fonts',
143 dest: '<%= buildDir %>/themes/material/',
144 },
145 {
146 expand: true,
147 overwrite: true,
148 cwd: 'node_modules/materialize-css/',
149 src: 'font',
150 dest: '<%= buildDir %>/themes/material',
151 },
152 {
153 expand: true,
154 overwrite: true,
155 cwd: '<%= appDir %>/lib/roboto-fontface/fonts/',
156 src: '*',
157 dest: '<%= buildDir %>/themes/material/fonts/roboto/',
158 },
159 {
160 expand: true,
161 overwrite: true,
162 cwd: '<%= appDir %>/lib/material-design-icons-iconfont/dist/fonts/',
163 src: '*',
164 dest: '<%= buildDir %>/themes/material/fonts/',
165 },
166 ],
167 },
168 pics: {
169 files: [
170 {
171 expand: true,
172 overwrite: true,
173 cwd: '<%= appDir %>/themes/_global/',
174 src: 'img',
175 dest: '<%= buildDir %>/themes/_global/',
176 },
177 ],
178 },
179 },
180 clean: {
181 css: {
182 src: ['<%= buildDir %>/**/*.css'],
183 },
184 js: {
185 src: ['<%= buildDir %>/**/*.js', '<%= buildDir %>/**/*.map'],
186 },
187 all: {
188 src: ['./<%= buildDir %>'],
189 },
190 },
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 );
216 };