-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
150 lines (137 loc) · 4.38 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// npm install grunt-contrib-concat --save-dev
// npm install grunt-contrib-cssmin --save-dev
// npm install grunt-contrib-sass --save-dev
// npm install grunt-contrib-uglify --save-dev
// npm install grunt-contrib-watch --save-dev
// npm install grunt-processhtml --save-dev
// npm install grunt-contrib-compass --save-dev
// npm install grunt-contrib-imagemin --save-dev
// npm install grunt-includes --save-dev
// npm install grunt-uncss --save-dev
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
build: {
files: {
'build/js/main.min.js': ['js/main.js']
}
}
},
// sass: { // Task
// dist: { // Target
// options: { // Target options
// style: 'compressed'
// },
// files: { // Dictionary of files
// 'css/main.css': 'scss/main.scss' // 'destination': 'source'
// }
// }
// },
compass: {
dist: {
options: {
config: 'config.rb'
}
}
},
// uncss: {
// build: {
// options: {
// ignore : [
// '.dark-bg',
// '.scrolled',
// '.page-home .page-banner.scrolled h1:before',
// '.page-home .page-banner.scrolled h1:after',
// '.show'
// ],
// // For some reason Uncss is only ignoring the first class specified so we have to apply this hack
// // Commented out because Uncss was not adding the raw css below, used js instead
// //raw : '.page-banner.scrolled h1:before, .page-banner.scrolled h1:after {opacity:0;}',
// stylesheets : ['css/main.css']
// },
// files: {
// 'build/css/main.css': ['*.html','models/*.html']
// }
// }
// },
cssmin: {
combine: {
files: {
'build/css/main.min.css': ['css/main.css']
}
}
},
processhtml: {
build: {
files: {
'partials/output/header.html' : ['partials/header.html'],
'partials/output/footer.html' : ['partials/footer.html'],
}
}
},
includes: {
default: {
cwd: 'templates',
src: [ '*.html','models/*.html' ], // checks templates dir for html files
dest: '.', // export to current directory
options: {
flatten: true,
includePath: 'partials' // directory containing partial includes
}
},
build: {
cwd: 'templates',
src: [ '*.html','models/*.html' ], // checks templates dir for html files
dest: 'build/', // export to
options: {
flatten: true,
includePath: 'partials/output' // directory containing partial includes
}
}
},
imagemin: { // Task
dynamic: { // Target
files: [{
expand: true, // Enable dynamic expansion
cwd: 'images/', // Src matches are relative to this path
src: ['**/*.{png,jpg,gif}'], // Actual patterns to match
dest: 'build/images' // Destination path prefix
}]
}
},
watch: {
options: {
livereload: true,
sourcemap: true
},
// sass: {
// files:'scss/*.scss',
// tasks:'sass'
// },
compass: {
files:'scss/*.scss',
tasks:'compass'
},
includes: {
files: ['partials/*.html','templates/*.html','templates/models/*.html'],
tasks: 'includes:default'
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-compass');
// grunt.loadNpmTasks('grunt-uncss');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-processhtml');
grunt.loadNpmTasks('grunt-includes');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default tasks
grunt.registerTask('default', ['includes:default','compass']);
// Build tasks
grunt.registerTask('build', ['compass','cssmin','processhtml','includes:build','imagemin','uglify']);
};