-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
118 lines (102 loc) · 3.11 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
//Gruntfile
module.exports = function(grunt) {
//Initializing the configuration object
grunt.initConfig({
// Paths variables
paths: {
// Development where put LESS files, etc
assets: {
less: 'httpdocs/assets/less/',
css: 'httpdocs/assets/css/',
js: 'httpdocs/assets/js/src/',
vendor: 'httpdocs/assets/vendor/'
},
// Production where Grunt output the files
css: 'httpdocs/assets/css/',
js: 'httpdocs/assets/js/'
},
// Task configuration
concat: {
options: {
separator: ';',
},
js_frontend: {
src: [
'<%= paths.assets.vendor %>jquery/dist/jquery.js',
'<%= paths.assets.vendor %>jquery-ui/jquery-ui.js',
'<%= paths.assets.js %>frontend.js'
],
dest: '<%= paths.js %>frontend.js',
},
js_backend: {
src: [
'<%= paths.assets.vendor %>jquery/dist/jquery.js',
'<%= paths.assets.vendor %>jquery-ui/jquery-ui.js',
'<%= paths.assets.js %>backend.js'
],
dest: '<%= paths.js %>backend.js',
}
},
// ------------------------------------------------------------------------
less: {
core: {
options: {
paths: ["<%= paths.css %>"],
cleancss: true,
plugins: [
new (require('less-plugin-autoprefix'))({browsers: ["last 2 versions"]})
]
},
files: {
"<%= paths.css %>frontend/frontend.css": "<%= paths.assets.less %>frontend.less",
"<%= paths.css %>backend/backend.css": "<%= paths.assets.less %>backend.less",
"<%= paths.css %>core/api.css": "<%= paths.assets.less %>api.less",
"<%= paths.css %>core/email.css": "<%= paths.assets.less %>email.less",
}
},
api: {
options: {
paths: ["<%= api.css %>"],
cleancss: true,
modifyVars: {
}
},
files: {
"<%= paths.css %>core/api.css": "<%= paths.assets.less %>api.less",
}
},
},
uglify: {
options: {
mangle: false // Use if you want the names of your functions and variables unchanged
},
frontend: {
files: {
'<%= paths.js %>frontend.min.js': '<%= paths.js %>frontend.js',
}
},
backend: {
files: {
'<%= paths.js %>backend.min.js': '<%= paths.js %>backend.js',
}
},
},
watch: {
less: {
files: ['<%= paths.assets.less %>*.less', '<%= paths.assets.less %>/mobile/*.less'], //watched files
tasks: ['less:core'],
options: {
livereload: true
}
}
}
});
// Plugin loading
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
// Task definition
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['less:core']);
};