-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
101 lines (97 loc) · 3.69 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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/*less: {
development: {
options: {
paths: ['vendor/braincrafted/bootstrap-bundle/Braincrafted/Bundle/BootstrapBundle/Resources/less']
},
files: {
"app/Resources/css/braincrafted.css" : "vendor/braincrafted/bootstrap-bundle/Braincrafted/Bundle/BootstrapBundle/Resources/less/form.less"
}
}
},*/
bowercopy: {
options: {
srcPrefix: 'bower_components'
},
stylesheets: {
options: {
destPrefix: 'src/AppBundle/Resources/css'
},
files: {
'leaflet.css' : 'leaflet/dist/leaflet.css'
}
},
scripts: {
options: {
destPrefix: 'src/AppBundle/Resources/js'
},
files: {
'leaflet.min.js': 'leaflet/dist/leaflet.js',
'jquery.min.js': 'jquery/dist/jquery.min.js',
'spin.min.js': 'spin.js/spin.min.js',
'leaflet.spin.js': 'leaflet-spin/leaflet.spin.js',
'floatThead.js': 'jquery.floatThead/dist/jquery.floatThead.min.js'
}
}
},
rewrite: {
dist: {
src: "src/AppBundle/Resources/css/leaflet.css",
editor: function(contents, filePath) {
return contents.replace(/images/g, "../img");
}
}
},
cssmin: {
target: {
files: [{
expand: true,
cwd: 'src/AppBundle/Resources/css',
src: ['*.css', '!*min.css'],
dest: 'web/css',
ext: '.min.css'
}]
}
},
uglify: {
leaflet: {
files: {
'web/js/leaflet.min.js': ['src/AppBundle/Resources/js/leaflet.min.js'],
'web/js/leaflet.ajax.min.js': ['src/AppBundle/Resources/js/leaflet.ajax.min.js'],
'web/js/weather.leaflet.js' : ['src/AppBundle/Resources/js/weather.leaflet.js'],
'web/js/jquery.min.js' : ['src/AppBundle/Resources/js/jquery.min.js'],
'web/js/leaflet.spin.min.js': ['src/AppBundle/Resources/js/leaflet.spin.js'],
'web/js/spin.min.js': ['src/AppBundle/Resources/js/spin.min.js'],
'web/js/floatThead.js': ['src/AppBundle/Resources/js/floatThead.js'],
'web/js/admin.js': ['src/AppBundle/Resources/js/admin.js']
}
}
},
copy: {
dist: {
expand: true,
cwd: 'bower_components/leaflet/dist/images',
src: ['layers*.png'],
dest: 'src/AppBundle/Resources/img'
},
prod: {
expand: true,
cwd: 'src/AppBundle/Resources/img',
src: ['*'],
dest: 'web/img'
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-bowercopy');
grunt.loadNpmTasks('grunt-rewrite');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
// Default task(s).
grunt.registerTask('default', ['bowercopy', 'rewrite', 'cssmin', 'uglify', 'copy']);
};