forked from csarrazi/CsaGuzzleBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
155 lines (154 loc) · 5.51 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
module.exports = function (grunt) {
grunt.initConfig({
vars: {
sourceDir: 'assets-src',
buildDir: 'build',
distDir: 'src',
resourcesDir: '<%= vars.distDir %>/Resources',
vendorDir: 'vendor',
twigResource: 'views/Collector/icon.html.twig'
},
pkg: grunt.file.readJSON('package.json'),
'imagemagick-convert': {
dist: {
args: [
'-resize', '30',
'-background', 'none',
'<%= vars.sourceDir %>/img/icon.svg',
'<%= vars.buildDir %>/img/icon.png'
],
fatals: true
}
},
base64: {
'<%= vars.buildDir %>/img/icon.b64': '<%= vars.buildDir %>/img/icon.png'
},
preprocess: {
twig: {
src: '<%= vars.sourceDir %>/<%= vars.twigResource %>',
dest: '<%= vars.resourcesDir %>/<%= vars.twigResource %>'
}
},
sass: {
options: {
style: 'compressed',
precision: 10
},
dist: {
files: [{
expand: true,
cwd: '<%= vars.sourceDir %>/sass',
src: ['main.sass'],
dest: '<%= vars.buildDir %>/public/css',
ext: '.css'
}]
}
},
concat: {
options: {
separator: ';'
},
js: {
src: [
'bower_components/jquery/dist/jquery.js',
'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap/tab.js',
'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap/collapse.js',
'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap/transition.js',
'bower_components/prism/components/prism-core.js',
'bower_components/prism/components/prism-markup.js',
'bower_components/prism/plugins/line-numbers/prism-line-numbers.js',
'<%= vars.sourceDir %>/js/*.js'
],
dest: '<%= vars.buildDir %>/js/profile.js'
}
},
uglify: {
options: {
mangle: false
},
js: {
files: {
'<%= vars.resourcesDir %>/public/js/profile.min.js': '<%= vars.buildDir %>/js/profile.js'
}
}
},
cssmin: {
combine: {
files: {
'<%= vars.resourcesDir %>/public/css/screen.min.css': [
'<%= vars.buildDir %>/public/css/*.css',
'bower_components/prism/themes/prism-coy.css'
]
}
}
},
watch: {
icon: {
files: ['<%= vars.sourceDir %>/img/icon.svg'],
tasks: ['icon'],
options: {
livereload: true
}
},
sass: {
files: [
'<%= vars.sourceDir %>/sass/*.sass',
'<%= vars.sourceDir %>/sass/*.scss'
],
tasks: ['sass', 'cssmin'],
options: {
livereload: true
}
},
js: {
files: [
'bower_components/jquery/dist/jquery.js',
'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap/tab.js',
'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap/collapse.js',
'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap/transition.js',
'bower_components/prism/components/prism-core.js',
'bower_components/prism/components/prism-markup.js',
'<%= vars.sourceDir %>/js/*.js'
],
tasks: ['concat', 'uglify'],
options: {
livereload: true
}
}
},
shell: {
options: {
failOnError: true
},
mkdir: {
command: 'mkdir -p <%= vars.buildDir %>/views/Collector <%= vars.buildDir %>/img'
},
clean: {
command: 'rm -rf build'
}
},
phpunit: {
classes: {
dir: '<%= vars.distDir %>/Tests/'
},
options: {
bin: '<%= vars.vendorDir %>/bin/phpunit',
colors: true,
bootstrap: '<%= vars.vendorDir %>/autoload.php'
}
}
});
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-imagemagick');
grunt.loadNpmTasks('grunt-base64');
grunt.loadNpmTasks('grunt-preprocess');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-phpunit');
grunt.registerTask('icon', ['shell:mkdir', 'imagemagick-convert', 'base64', 'preprocess']);
grunt.registerTask('assets', ['sass', 'cssmin', 'concat', 'uglify']);
grunt.registerTask('default', ['icon', 'assets', 'shell:clean']);
};