-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
97 lines (83 loc) · 2.35 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
/* jshint node: true */
module.exports = function(grunt) {
'use strict';
// Force use of Unix newlines
grunt.util.linefeed = '\n';
RegExp.quote = function (string) {
return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
};
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Metadata.
meta: {
distPath: 'dist/',
srcPath: 'src/'
},
banner: '/*!\n' +
' * =====================================================\n' +
' * Foxui v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
' * Licensed under <%= pkg.license %> (https://github.com/foxui/<%= pkg.name %>/blob/master/LICENSE)\n' +
' *\n' +
' * v<%= pkg.version %> designed by @fex-team.\n' +
' * =====================================================\n' +
' */\n',
clean: {
dist: ['<%= meta.distPath %>']
},
sass: {
options: {
banner: '<%= banner %>',
style: 'expanded',
unixNewlines: true
},
dev: {
files: {
'<%= meta.srcPath %>css/<%= pkg.name %>.css': 'sass/<%= pkg.name %>.scss'
}
}
},
copy: {
css: {
expand: true,
cwd: 'src/css',
src: '**/*',
dest: '<%= meta.distPath %>css/'
},
src: {
expand: true,
cwd: 'src/',
src: '*.html',
dest: '<%= meta.distPath %>'
}
},
cssmin: {
options: {
banner: '', // set to empty; see bellow
keepSpecialComments: '*' // set to '*' because we already add the banner in sass
},
foxui: {
src: '<%= meta.distPath %>css/<%= pkg.name %>.css',
dest: '<%= meta.distPath %>css/<%= pkg.name %>.min.css'
}
},
watch: {
scripts: {
files: [
'sass/*',
'src/**/*'
],
tasks: ['dist']
}
}
});
// Load the plugins
require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
require('time-grunt')(grunt);
// Default task(s).
grunt.registerTask('dist-css', ['sass', 'copy:css', 'cssmin']);
grunt.registerTask('dist', ['clean', 'dist-css', 'copy:src']);
grunt.registerTask('build', ['dist']);
grunt.registerTask('default', ['dist']);
};