forked from camalot/jenkins-dark-stylish
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgruntfile.js
76 lines (73 loc) · 2.05 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
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
var pkg = grunt.file.readJSON('package.json');
grunt.initConfig({
clean: {
dist: {
src: ["dist/*"]
}
},
less: {
dist: {
options: {
//paths: ["assets/css"]
},
files: {"dist/jenkins-dark.css": "jenkins-dark.less"}
}
},
cssmin: {
target: {
files: [{
expand: true,
cwd: 'dist/',
src: ['*.css', '!*.min.css'],
dest: 'dist/',
ext: '.min.css'
}]
}
},
replace: {
dist: {
options: {
patterns: [{
match: /\${VERSION}/g,
replacement: pkg.version
}, {
match: /jenkins-dark-theme<\/artifactId>\s+<version>[^>]*<\/version>/g,
replacement: 'jenkins-dark-theme</artifactId>\n <version>' + pkg.version + '</version>'
}]
},
files: [{
src: ['dist/jenkins-dark.css'],
dest: 'dist/jenkins-dark.css'
}, {
src: ['plugin/pom.xml'],
dest: 'plugin/pom.xml'
}]
}
},
postcss: {
options: {
map: false,
processors: [
require('autoprefixer')({
browsers: 'last 2 versions'
}), // add vendor prefixes
require('postcss-encode-base64-inlined-images'),
require('cssnano')() // minify the result
]
},
dist: {
files: [{
expand: true,
cwd: 'dist/',
src: ['*.css', '!*.min.css'],
dest: 'dist/',
ext: '.min.css'
}]
}
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.registerTask('default', ['clean', 'less', 'replace', 'cssmin', 'postcss']);
}