This repository has been archived by the owner on Nov 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathGruntfile.js
108 lines (91 loc) · 3.03 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
/// <binding BeforeBuild='build' />
/*
This file in the main entry point for defining grunt tasks and using grunt plugins.
Click here to learn more. http://go.microsoft.com/fwlink/?LinkID=513275&clcid=0x409
*/
module.exports = function (grunt) {
grunt.initConfig({
less: {
build: {
options: {
paths: ["."],
plugins: [
new (require('less-plugin-autoprefix'))({ browsers: ["last 2 versions"] })
],
compress: false
},
files: {
"site/siteX.css": "site/less/import.less"
}
}
},
cssmin: {
build: {
options: {
shorthandCompacting: false,
roundingPrecision: -1,
report: 'min',
level: {
1: {
specialComments: 0
}
}
},
files: {
'wwwroot/css/site.min.css': ['site/siteX.css']
}
}
},
cachebreaker: {
build: {
options: {
match: [
{
'site.min.js': 'wwwroot/js/site.min.js',
'site.min.css': 'wwwroot/css/site.min.css'
}
],
replacement: 'md5'
},
files: {
src: ['Pages/Shared/_Layout.cshtml']
}
}
},
clean: {
build: ['site/siteX.css']
},
uglify: {
build: {
options: {
//mangle: false,
//compress: false,
//beautify: true
//,
mangle: true,
compress: true,
beautify: false,
output: {
comments: false
}
},
files: {
'wwwroot/js/site.min.js': ['site/js/site.js']
}
}
}
});
grunt.registerTask("default", [""]);
grunt.registerTask("buildless", ["less:build"]);
grunt.registerTask("builduglify", ["uglify:build"]);
grunt.registerTask("buildcachebreaker", ["cachebreaker:build"]);
grunt.registerTask("buildcssmin", ["cssmin:build"]);
grunt.registerTask("buildclean", ["clean:build"]);
grunt.registerTask("build", ["buildless", "builduglify", "buildcssmin", "buildcachebreaker", "buildclean"]);
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-cache-breaker');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
};