This repository has been archived by the owner on Jan 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
113 lines (109 loc) · 2.96 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
module.exports = function(grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.registerTask('default', ['build']);
grunt.registerTask('build', ['clean', 'less', 'replace', 'kss', 'copy:main', 'copy:dist', 'usebanner']);
grunt.registerTask('serve', ['connect', 'watch']);
grunt.registerTask('deploy', ['clean', 'build', 'gh-pages']);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: ['build', 'dist'],
connect: {
all: {
options: {port: 8500, hostname: "0.0.0.0"}
}
},
usebanner: {
options: {
position: 'top',
banner: '/*\n kungbib-styles <%= pkg.version %>\n <%= pkg.description %>\n <%= pkg.homepage %>\n*/\n',
linebreak: true
},
files: {
src: ['dist/css/kb-style.css', 'dist/less/kb-style.less']
}
},
watch: {
files: ["custom/**/*", "template/**/*", "examples/**/*", "package.json"],
tasks: ['default'],
options: {
nospawn: true,
livereload: 35790
}
},
less: {
development: {
options: {
compress: true,
yucompress: true,
optimization: 2
},
files: {
"build/css/kb-style.css": "theme/theme.less"
}
},
kssdev: {
options: {
compress: true,
yucompress: true,
optimization: 2
},
files: {
"template/public/kss.css": "template/public/kss.less"
}
}
},
kss: {
options: {
// css: './css/kb-style.css',
template: 'template'
},
dist: {
files: {
'build': ['custom']
}
}
},
replace: {
dist: {
options: {
patterns: [
{
match: 'timestamp',
replacement: '<%= grunt.template.today("yyyy-mm-dd - HH:MM") %>'
},
{
match: 'version',
replacement: '<%= pkg.version %>'
}
]
},
files: [
{expand: true, flatten: true, src: ['template/tmphtml/index.html'], dest: 'template/'}
]
}
},
copy: {
main: {
files: [
{expand: true, src: ['examples/**'], dest: 'build/'},
{expand: true, src: ['assets/**'], dest: 'build/'},
{expand: true, flatten: true, src: ['node_modules/bootstrap/dist/js/bootstrap.min.js'], dest: 'build/vendor/'},
{expand: true, flatten: true, src: ['node_modules/jquery/dist/jquery.min.js'], dest: 'build/vendor/'},
]
},
dist: {
files: [
{expand: true, cwd: 'assets/', src: ['*'], dest: 'dist/assets/'},
{expand: true, cwd: 'build/css/', src: ['*'], dest: 'dist/css/'},
{expand: true, cwd: 'custom/', src: ['**/*.less'], dest: 'dist/less/'}
]
}
},
'gh-pages': {
options: {
base: 'build'
},
src: '**/*'
}
});
};