aboutsummaryrefslogtreecommitdiffhomepage
path: root/Gruntfile.js
diff options
context:
space:
mode:
Diffstat (limited to 'Gruntfile.js')
-rw-r--r--Gruntfile.js219
1 files changed, 219 insertions, 0 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 00000000..c63c392b
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,219 @@
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: {
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 'node_modules/jquery/dist/jquery.js',
47 'node_modules/jquery-ui/jquery-ui.js',
48 'node_modules/materialize-css/bin/materialize.js',
49 '<%= appDir %>/themes/_global/js/restoreScroll.js',
50 '<%= appDir %>/themes/material/js/init.js'
51 ],
52 dest: '<%= buildDir %>/material.js'
53 },
54 jsBaggy: {
55 src: [
56 'node_modules/jquery/dist/jquery.js',
57 'node_modules/jquery-ui/jquery-ui.js',
58 '<%= appDir %>/themes/baggy/js/init.js',
59 '<%= appDir %>/themes/_global/js/restoreScroll.js',
60 '<%= appDir %>/themes/baggy/js/autoClose.js',
61 '<%= appDir %>/themes/baggy/js/autoCompleteTags.js',
62 '<%= appDir %>/themes/baggy/js/closeMessage.js',
63 '<%= appDir %>/themes/baggy/js/popupForm.js',
64 '<%= appDir %>/themes/baggy/js/saveLink.js'
65 ],
66 dest: '<%= buildDir %>/baggy.js'
67 },
68 cssMaterial: {
69 src: [
70 'node_modules/materialize-css/bin/materialize.css',
71 '<%= appDir %>/themes/material/css/*.css'
72 ],
73 dest: '<%= buildDir %>/material.css'
74 },
75 cssBaggy: {
76 src: [
77 '<%= appDir %>/themes/baggy/css/*.css'
78 ],
79 dest: '<%= buildDir %>/baggy.css'
80 }
81 },
82 browserify: {
83 '<%= buildDir %>/material.browser.js': ['<%= buildDir %>/material.js'],
84 '<%= buildDir %>/baggy.browser.js': ['<%= buildDir %>/baggy.js']
85 },
86 uglify: {
87 material: {
88 files: {
89 '<%= buildDir %>/themes/material/js/material.min.js':
90 ['<%= buildDir %>/material.browser.js']
91 },
92 options: {
93 sourceMap: true,
94 },
95 },
96 baggy: {
97 files: {
98 '<%= buildDir %>/themes/baggy/js/baggy.min.js':
99 ['<%= buildDir %>/baggy.browser.js']
100 },
101 options: {
102 sourceMap: true,
103 },
104 },
105 },
106 copy: {
107 pickerjs: {
108 expand: true,
109 cwd: 'node_modules/pickadate/lib',
110 src: 'picker.js',
111 dest: '<%= buildDir %>'
112 },
113 annotator: {
114 expand: true,
115 cwd: 'node_modules/annotator/pkg',
116 src: 'annotator.min.js',
117 dest: '<%= buildDir %>/themes/_global/js/'
118 }
119 },
120 symlink: {
121 baggyfonts: {
122 files: [
123 {
124 expand: true,
125 overwrite: true,
126 cwd: "<%= appDir %>/lib/icomoon-bower/",
127 src: "fonts",
128 dest: "<%= buildDir %>/themes/baggy/"
129 },
130 {
131 expand: true,
132 overwrite: true,
133 cwd: "<%= appDir %>/lib/bower-pt-sans/fonts",
134 src: "*",
135 dest: "<%= buildDir %>/themes/baggy/fonts/"
136 }
137 ]
138 },
139 materialfonts: {
140 files: [
141 {
142 expand: true,
143 overwrite: true,
144 cwd: "<%= appDir %>/lib/icomoon-bower/",
145 src: "fonts",
146 dest: "<%= buildDir %>/themes/material/"
147 },
148 {
149 expand: true,
150 overwrite: true,
151 cwd: "node_modules/materialize-css/",
152 src: "font",
153 dest: "<%= buildDir %>/themes/material"
154 },
155 {
156 expand: true,
157 overwrite: true,
158 cwd: "<%= appDir %>/lib/roboto-fontface/fonts/",
159 src: "*",
160 dest: "<%= buildDir %>/themes/material/fonts/roboto/"
161 },
162 {
163 expand: true,
164 overwrite: true,
165 cwd: "<%= appDir %>/lib/material-design-icons/iconfont/",
166 src: "*",
167 dest: "<%= buildDir %>/themes/material/fonts/"
168 }
169 ]
170 },
171 pics: {
172 files: [
173 {
174 expand: true,
175 overwrite: true,
176 cwd: '<%= appDir %>/themes/_global/',
177 src: 'img',
178 dest: '<%= buildDir %>/themes/_global/'
179 }
180 ]
181 }
182 },
183 clean: {
184 css: {
185 src: [ '<%= buildDir %>/**/*.css' ]
186 },
187 js: {
188 src: ['<%= buildDir %>/**/*.js', '<%= buildDir %>/**/*.map']
189 },
190 all: {
191 src: ['./<%= buildDir %>']
192 }
193 }
194 });
195
196 grunt.registerTask(
197 'fonts',
198 'Install fonts',
199 ['symlink:baggyfonts', 'symlink:materialfonts']
200 );
201
202 grunt.registerTask(
203 'js',
204 'Build and install js files',
205 ['clean:js', 'copy:pickerjs', 'concat:jsMaterial', 'concat:jsBaggy', 'browserify', 'uglify']
206 );
207
208 grunt.registerTask(
209 'default',
210 'Build and install everything',
211 ['clean', 'copy:pickerjs', 'concat', 'browserify', 'uglify', 'postcss', 'symlink']
212 );
213
214 grunt.registerTask(
215 'css',
216 'Compiles the stylesheets.',
217 ['clean:css', 'concat:cssMaterial', 'concat:cssBaggy', 'postcss']
218 );
219}