-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgruntfile.js
168 lines (151 loc) · 4.33 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
'use strict';
module.exports = function (grunt) {
require('time-grunt')(grunt); // Show elapsed time after tasks run to visualize performance
require('load-grunt-tasks')(grunt); // Load all Grunt tasks that are listed in package.json automagically
var JS_FILES = [
'./vendor/js/snap.svg-min.js',
'./vendor/js/reqwest.min.js',
'./vendor/js/strftime-min.js',
'./vendor/js/classie.js',
'./assets/js/highlight.pack.js',
'./assets/js/switch.js',
'./assets/js/scrollMenu.js',
'./assets/js/highlight.js',
'./assets/js/upcoming-events.js',
'./assets/js/navigation-main.js'
];
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// shell commands for use in Grunt tasks
shell: {
jekyllServe: { command: 'bundle exec jekyll serve' },
jekyllBuild: { command: 'bundle exec jekyll build' }
},
// watch for files to change and run tasks when they do
watch: {
javascript: {
files: ['assets/js/**/*.js'],
tasks: ['concat:development'],
options: { livereload: true } //using the browserextension
},
sass: {
files: ['_sass/**/*.{scss,sass}'],
tasks: ['sass'],
options: { livereload: true } //using the browserextension
}
},
// sass (libsass) config
sass: {
options: {
sourceMap: true,
relativeAssets: false,
outputStyle: 'expanded'
},
dev: {
files: [{
expand: true,
cwd: '_sass/',
src: ['**/*.{scss,sass}'],
dest: 'css/',
ext: '.css'
}]
},
build: {
files: [{
expand: true,
cwd: '_sass/',
src: ['**/*.{scss,sass}'],
dest: '_site/css/',
ext: '.css'
}]
}
},
// run tasks in parallel
concurrent: {
serve: [
'sass:dev',
'concat:development',
'watch',
'shell:jekyllServe'
],
options: { logConcurrentOutput: true }
},
postcss: {
options: {
map: false,
processors: [
require('autoprefixer')({browsers: 'last 2 versions'}),
require('cssnano')()
]
},
dist: {
src: '_site/css/*.css'
}
},
copy: {
vendor: {
files: [{
expand: true,
cwd: "bower_components/classie/",
src: "classie.js",
dest: "vendor/js"
},
{
expand: true,
cwd: "bower_components/reqwest/",
src: "reqwest.min.js",
dest: "vendor/js"
},
{
expand: true,
cwd: "bower_components/snap.svg/dist/",
src: "snap.svg-min.js",
dest: "vendor/js"
},
{
expand: true,
cwd: "bower_components/strftime/",
src: "strftime-min.js",
dest: "vendor/js"
}]
}
},
concat: {
options: {
separator: ';',
},
development : {
src: JS_FILES,
dest: 'js/cssclasses.js',
}
},
uglify : {
build : {
options : {
sourceMap: true
},
files: {
'js/cssclasses.min.js': JS_FILES
}
}
},
env : {
build : {
JEKYLL_ENV : 'production'
}
}
});
// Register the grunt serve task
grunt.registerTask('serve', [ 'copy:vendor', 'concurrent:serve' ]);
// Register the grunt build task
grunt.registerTask('build', [
'env:build',
'copy:vendor',
'shell:jekyllBuild',
'sass:build',
'postcss',
'uglify:build'
]);
// Register build as the default task fallback
grunt.registerTask('default', 'serve');
};