1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-22 01:46:51 +01:00

jekyll & grunt base

This commit is contained in:
Matthias Kretschmann 2013-11-18 01:08:13 +01:00
commit a4a8e5b605
10 changed files with 305 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
_site

201
Gruntfile.js Normal file
View File

@ -0,0 +1,201 @@
module.exports = function(grunt){
'use strict';
// config
var gruntConfig = {
src: '_src',
site: '_site',
assets: {
less: 'assets/less',
css: 'assets/css',
js: 'assets/js',
img: 'assets/img'
}
};
// banner
grunt.log.writeln("");
grunt.log.writeln(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>");
grunt.log.writeln("");
grunt.log.writeln(" Just what do you think you're doing, Matthias? ");
grunt.log.writeln("");
grunt.log.writeln(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>");
grunt.log.writeln("");
// Grunt config
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
config: gruntConfig,
// clean everything
clean: {
build: ['<%= config.site %>']
},
// Jekyll
jekyll: {
production : {
src: '<%= config.src %>'
},
},
// less
less: {
production: {
files: {
'<%= config.site %>/<%= config.assets.css %>/kremalicious.min.css' : '<%= config.src %>/<%= config.assets.less %>/kremalicious.less'
},
},
},
// combine css media queries
cmq: {
production: {
files: {
'<%= config.site %>/<%= config.assets.css %>/': ['<%= config.site %>/<%= config.assets.css %>/kremalicious.min.css']
}
}
},
// minify css
cssmin: {
production: {
files: {
'<%= config.site %>/<%= config.assets.css %>/kremalicious.min.css': ['<%= config.site %>/<%= config.assets.css %>/*.css']
}
}
},
// Concatenate and minify js
uglify: {
production: {
options: {
report: 'min',
mangle: true
},
files: {
'<%= config.site %>/<%= config.assets.js %>/kremalicious.min.js': [
'<%= config.src %>/<%= config.assets.js %>/script.js'
]
}
}
},
// image optimization
imagemin: {
assets: {
files: [
{
expand: true,
cwd: '<%= config.site %>/<%= config.assets.img %>/',
src: ['**/*.{png,jpg,jpeg,gif}'],
dest: '<%= config.site %>/<%= config.assets.img %>/'
}
]
},
touchicons: {
files: [
{
expand: true,
cwd: '<%= config.site %>/',
src: ['*.png'],
dest: '<%= config.site %>/',
ext: '.png'
}
]
},
},
// dev server
connect: {
server: {
options: {
port: 1337,
base: '_site'
}
}
},
// watch
watch: {
options: {
livereload: true
},
less: {
files: ['<%= config.src %>/<%= config.assets.less %>/*.less'],
tasks: ['less']
},
js: {
files: ['<%= config.src %>/<%= config.assets.js %>/*.js'],
tasks: ['uglify']
},
jekyll: {
files: [
'<%= config.src %>/*.html',
'<%= config.src %>/_includes/**',
'<%= config.src %>/_layouts/**'
],
tasks: ['jekyll', 'less', 'uglify']
},
},
// Deployment
rsync: {
options: {
args: ['--verbose'],
recursive: true,
syncDest: true,
compareMode: 'checksum',
ssh: true
},
production: {
options: {
src: '<%= config.site %>/',
dest: 'domains/kremalicious.com/html/',
host: 'kremalicious'
}
}
}
});
// Load NPM Tasks, smart code stolen from @bluemaex <https://github.com/bluemaex>
require('fs').readdirSync('node_modules').filter(function (file) {
return file && file.indexOf('grunt-') > -1;
}).forEach(function (file) {
grunt.loadNpmTasks(file);
});
// Default Task
grunt.registerTask('default', [
'watch'
]);
// Dev server
grunt.registerTask('server', [
'jekyll',
'less',
'cmq',
'cssmin',
'uglify',
'connect',
'watch'
]);
// Production build
grunt.registerTask('build', [
'clean',
'jekyll',
'imagemin',
'less',
'cmq',
'cssmin',
'uglify'
]);
// Deploy
grunt.registerTask('deploy', [
'rsync'
]);
};

10
_config.yml Normal file
View File

@ -0,0 +1,10 @@
name: kremalicious
description: Blog of designer &#38; developer Matthias Kretschmann
permalink: /:title
relative_permalinks: true
markdown: redcarpet
pygments: true
source: ./_src
destination: ./_site
exclude: ['design', 'node_modules', '_src/assets/less']

View File

View File

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{ page.title }}</title>
<meta name="viewport" content="width=device-width">
</head>
<body>
{% include header.html %}
{{ content }}
{% include footer.html %}
</body>
</html>

9
_src/_layouts/post.html Normal file
View File

@ -0,0 +1,9 @@
---
layout: default
---
<h2>{{ page.title }}</h2>
<p class="meta">{{ page.date | date_to_string }}</p>
<div class="post">
{{ content }}
</div>

View File

@ -0,0 +1,26 @@
---
layout: post
title: "Welcome to Jekyll!"
date: 2013-11-17 23:56:48
categories: jekyll update
---
You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes!
To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext.
Jekyll also offers powerful support for code snippets:
{% highlight ruby %}
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}
Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].
[jekyll-gh]: https://github.com/mojombo/jekyll
[jekyll]: http://jekyllrb.com

13
_src/index.html Normal file
View File

@ -0,0 +1,13 @@
---
layout: default
title: Your New Jekyll Site
---
<div id="home">
<h1>Blog Posts</h1>
<ul class="posts">
{% for post in site.posts %}
<li><span>{{ post.date | date_to_string }}</span> &raquo; <a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</div>

25
package.json Normal file
View File

@ -0,0 +1,25 @@
{
"name": "kremalicious",
"author": "Matthias Kretschmann <m@kretschmann.io>",
"description": "Blog of Matthias Kretschmann",
"version": "3.0.0",
"main": "Gruntfile.js",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-less": "~0.6.4",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-cssmin": "~0.6.2",
"grunt-contrib-imagemin": "~0.3.0",
"grunt-combine-media-queries": "~1.0.8",
"grunt-contrib-uglify": "~0.2.2",
"grunt-jekyll": "~0.4.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-rsync": "~0.2.1"
},
"repository": {
"type": "git",
"url": "git@github.com:kremalicious/.git"
}
}