Skip to content

Commit a472d16

Browse files
committed
Init Gruntjs build script
1 parent 8d0146f commit a472d16

11 files changed

+191
-1906
lines changed

.jshintrc

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"bitwise": true,
3+
"browser": true,
4+
"curly": true,
5+
"eqeqeq": true,
6+
"eqnull": true,
7+
"es5": false,
8+
"esnext": true,
9+
"immed": true,
10+
"jquery": true,
11+
"latedef": true,
12+
"newcap": true,
13+
"noarg": true,
14+
"node": true,
15+
"strict": false,
16+
"trailing": false,
17+
"undef": true,
18+
"multistr": true,
19+
"expr": true
20+
}

Gruntfile.js

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
'use strict';
2+
module.exports = function(grunt) {
3+
4+
grunt.initConfig({
5+
jshint: {
6+
options: {
7+
jshintrc: '.jshintrc'
8+
},
9+
all: [
10+
'Gruntfile.js',
11+
'assets/js/*.js',
12+
'assets/js/plugins/*.js',
13+
'!assets/js/scripts.min.js'
14+
]
15+
},
16+
recess: {
17+
dist: {
18+
options: {
19+
compile: true,
20+
compress: true
21+
},
22+
files: {
23+
'assets/css/main.min.css': [
24+
'assets/less/main.less'
25+
]
26+
}
27+
}
28+
},
29+
uglify: {
30+
dist: {
31+
files: {
32+
'assets/js/scripts.min.js': [
33+
'assets/js/plugins/*.js',
34+
'assets/js/_*.js'
35+
]
36+
}
37+
}
38+
},
39+
imagemin: {
40+
dist: {
41+
options: {
42+
optimizationLevel: 7,
43+
progressive: true
44+
},
45+
files: [{
46+
expand: true,
47+
cwd: 'images/',
48+
src: '{,*/}*.{png,jpg,jpeg}',
49+
dest: 'images/'
50+
}]
51+
}
52+
},
53+
svgmin: {
54+
dist: {
55+
files: [{
56+
expand: true,
57+
cwd: 'images/',
58+
src: '{,*/}*.svg',
59+
dest: 'images/'
60+
}]
61+
}
62+
},
63+
watch: {
64+
less: {
65+
files: [
66+
'assets/less/*.less',
67+
'assets/less/bootstrap/*.less'
68+
],
69+
tasks: ['recess']
70+
},
71+
js: {
72+
files: [
73+
'<%= jshint.all %>'
74+
],
75+
tasks: ['jshint','uglify']
76+
}
77+
},
78+
clean: {
79+
dist: [
80+
'assets/css/main.min.css',
81+
'assets/js/scripts.min.js'
82+
]
83+
}
84+
});
85+
86+
// Load tasks
87+
grunt.loadNpmTasks('grunt-contrib-clean');
88+
grunt.loadNpmTasks('grunt-contrib-jshint');
89+
grunt.loadNpmTasks('grunt-contrib-uglify');
90+
grunt.loadNpmTasks('grunt-contrib-watch');
91+
grunt.loadNpmTasks('grunt-recess');
92+
grunt.loadNpmTasks('grunt-contrib-imagemin');
93+
grunt.loadNpmTasks('grunt-svgmin');
94+
95+
// Register tasks
96+
grunt.registerTask('default', [
97+
'clean',
98+
'recess',
99+
'uglify',
100+
'imagemin',
101+
'svgmin'
102+
]);
103+
grunt.registerTask('dev', [
104+
'watch'
105+
]);
106+
107+
};

_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ kramdown:
6464
coderay_css: class
6565

6666
include: [".htaccess"]
67-
exclude: ["lib", "config.rb", "Capfile", "config", "log", "Rakefile", "Rakefile.rb", "tmp", "less", "minimal-mistakes.sublime-project", "minimal-mistakes.sublime-workspace"]
67+
exclude: ["lib", "config.rb", "Capfile", "config", "log", "Rakefile", "Rakefile.rb", "tmp", "less", "*.sublime-project", "*.sublime-workspace", "test", "spec", "Gruntfile.js", "package.json", "node_modules"]

_includes/head.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<!-- Google Webfonts -->
3939
<link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700|PT+Serif:400,700,400italic' rel='stylesheet' type='text/css'>
4040
<!-- For all browsers -->
41-
<link rel="stylesheet" href="{{ site.url }}/assets/css/main.css">
41+
<link rel="stylesheet" href="{{ site.url }}/assets/css/main.min.css">
4242

4343
<!--[if (lt IE 9) & (!IEMobile)]>
4444
<link rel="stylesheet" href="{{ site.url }}/assets/css/ie.css">

_includes/scripts.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
22
<script>window.jQuery || document.write('<script src="{{ site.url }}/assets/js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
3-
<script src="{{ site.url }}/assets/js/main.min.js"></script>
3+
<script src="{{ site.url }}/assets/js/scripts.min.js"></script>
44
{% if site.google_analytics %}
55
<!-- Asynchronous Google Analytics snippet -->
66
<script>

assets/js/_main.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*! Plugin options and other jQuery stuff */
2+
3+
// FitVids options
4+
$(function() {
5+
$("article").fitVids();
6+
});
7+
8+
// Table of Contents toggle
9+
$(function() {
10+
$(".toc h3").click(function () {
11+
$("#drawer").toggleClass("hidden");
12+
});
13+
});
14+
15+
// Add lightbox class to all image links
16+
$("a[href$='.jpg'],a[href$='.png'],a[href$='.gif']").addClass("image-popup");
17+
18+
// Magnific-Popup options
19+
$(document).ready(function() {
20+
$('.image-popup').magnificPopup({
21+
type: 'image',
22+
tLoading: 'Loading image #%curr%...',
23+
gallery: {
24+
enabled: true,
25+
navigateByImgClick: true,
26+
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
27+
},
28+
image: {
29+
tError: '<a href="%url%">Image #%curr%</a> could not be loaded.',
30+
},
31+
removalDelay: 300, // Delay in milliseconds before popup is removed
32+
// Class that is added to body when popup is open.
33+
// make it unique to apply your CSS animations just to this exact popup
34+
mainClass: 'mfp-fade'
35+
});
36+
});

0 commit comments

Comments
 (0)