This repository has been archived by the owner on Jun 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathGruntfile.js
101 lines (91 loc) · 1.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
var historyApiFallback = require('connect-history-api-fallback')
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
browserSync: {
dev:{
bsFiles: {
src : [
'*.html',
'assets/css/*.css',
'assets/js/*.js',
'assets/js/{*,}/*.js',
'libs/*.js',
'libs/{*,}/*.js'
]
},
options: {
server: {
baseDir: "./",
middleware: [ historyApiFallback() ]
},
watchTask: false,
open: false
}
}
},
useminPrepare: {
html: 'index.html',
options: {
dest: 'public'
}
},
usemin:{
html:['public/index.html']
},
copy:{
html: {
src: './index.html', dest: 'public/index.html'
},
assets_dir: {
src: 'assets/', dest: 'public/'
},
img: {
src: 'assets/img/*', dest: 'public/'
},
font: {
src: 'assets/font/*', dest: 'public/'
},
text: {
src: 'assets/text/*', dest: 'public/'
},
svg: {
src: 'assets/svg/*', dest: 'public/'
}
},
postcss: {
options: {
map: false, // inline sourcemaps
processors: [
//require('pixrem')(), // add fallbacks for rem units
require('autoprefixer')({browsers: 'last 2 versions'}), // add vendor prefixes
//require('cssnano')() // minify the result
]
},
dist: {
src: 'assets/css/*.css'
}
},
watch: {
scripts: {
files: 'assets/css/*.css',
tasks: ['postcss'],
},
},
});
grunt.registerTask('dev', ['browserSync:dev']);
grunt.registerTask('build',[
'copy:html',
'copy:assets_dir',
'copy:font',
'copy:img',
'copy:text',
'copy:svg',
'postcss',
'useminPrepare',
'concat',
'uglify',
'cssmin',
'usemin'
]);
};