-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
79 lines (74 loc) · 2.31 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
"use strict";
module.exports = grunt => {
var themes = ["alkomprar", "alkosto", "kalley", "ktronix"];
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
clean: {
dist: ["dist/**/css/*", "dist/**/json/*"]
},
cssmin : {
options : {
banner: "/*! <%= pkg.name %> - v<%= pkg.version %> */",
compatibility: "ie8",
report: "gzip",
inline: ["local"],
level: {
1: {
all: true
},
2: {
all: true
}
}
},
dist: {
expand: true,
cwd: "dist",
src: ["**/css/*.css"],
dest: "dist"
}
},
json_minification: {
target: {
files: [{
expand: true,
cwd: "src/json",
src: ["<%= theme %>.json"],
dest: "dist/<%= theme %>/json",
rename: dest => {
return dest + "/tiendas.json";
}
}]
}
},
less: {
options: {
compress: true,
modifyVars: {
themeName: "<%= theme %>"
},
paths: ["dist/css"],
},
theme : {
files: {
"dist/<%= theme %>/css/detalle.css": "src/less/detalle.less",
"dist/<%= theme %>/css/tiendas.css": "src/less/tiendas.less"
}
}
},
themes: themes
});
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks("grunt-json-minification");
grunt.registerMultiTask("themes", "Generate styles for each site", function(){
const done = this.async();
grunt.log.writeln("Compile less for: " + this.data);
grunt.config("theme", this.data);
grunt.task.run("less");
grunt.task.run("json_minification");
done();
});
grunt.registerTask("default", ["clean", "themes", "cssmin"]);
};