From a4a8e5b6059481d5db5d1a6d81bedef5b986b0ff Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 18 Nov 2013 01:08:13 +0100 Subject: [PATCH] jekyll & grunt base --- .gitignore | 2 + Gruntfile.js | 201 ++++++++++++++++++ _config.yml | 10 + _src/_includes/footer.html | 0 _src/_includes/header.html | 0 _src/_layouts/default.html | 19 ++ _src/_layouts/post.html | 9 + .../2013-11-17-welcome-to-jekyll.markdown | 26 +++ _src/index.html | 13 ++ package.json | 25 +++ 10 files changed, 305 insertions(+) create mode 100644 .gitignore create mode 100644 Gruntfile.js create mode 100644 _config.yml create mode 100644 _src/_includes/footer.html create mode 100644 _src/_includes/header.html create mode 100644 _src/_layouts/default.html create mode 100644 _src/_layouts/post.html create mode 100644 _src/_posts/2013-11-17-welcome-to-jekyll.markdown create mode 100644 _src/index.html create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..5a87346b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +_site \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 00000000..4cba1b9f --- /dev/null +++ b/Gruntfile.js @@ -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 + 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' + ]); + +}; \ No newline at end of file diff --git a/_config.yml b/_config.yml new file mode 100644 index 00000000..f0f9565d --- /dev/null +++ b/_config.yml @@ -0,0 +1,10 @@ +name: kremalicious +description: Blog of designer & developer Matthias Kretschmann +permalink: /:title +relative_permalinks: true +markdown: redcarpet +pygments: true + +source: ./_src +destination: ./_site +exclude: ['design', 'node_modules', '_src/assets/less'] \ No newline at end of file diff --git a/_src/_includes/footer.html b/_src/_includes/footer.html new file mode 100644 index 00000000..e69de29b diff --git a/_src/_includes/header.html b/_src/_includes/header.html new file mode 100644 index 00000000..e69de29b diff --git a/_src/_layouts/default.html b/_src/_layouts/default.html new file mode 100644 index 00000000..2f5b3e50 --- /dev/null +++ b/_src/_layouts/default.html @@ -0,0 +1,19 @@ + + + + + + {{ page.title }} + + + + + + {% include header.html %} + + {{ content }} + + {% include footer.html %} + + + diff --git a/_src/_layouts/post.html b/_src/_layouts/post.html new file mode 100644 index 00000000..04e3586b --- /dev/null +++ b/_src/_layouts/post.html @@ -0,0 +1,9 @@ +--- +layout: default +--- +

{{ page.title }}

+

{{ page.date | date_to_string }}

+ +
+{{ content }} +
diff --git a/_src/_posts/2013-11-17-welcome-to-jekyll.markdown b/_src/_posts/2013-11-17-welcome-to-jekyll.markdown new file mode 100644 index 00000000..f4a456a1 --- /dev/null +++ b/_src/_posts/2013-11-17-welcome-to-jekyll.markdown @@ -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 diff --git a/_src/index.html b/_src/index.html new file mode 100644 index 00000000..c7268192 --- /dev/null +++ b/_src/index.html @@ -0,0 +1,13 @@ +--- +layout: default +title: Your New Jekyll Site +--- + +
+

Blog Posts

+
    + {% for post in site.posts %} +
  • {{ post.date | date_to_string }} » {{ post.title }}
  • + {% endfor %} +
+
\ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 00000000..220f16c4 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "kremalicious", + "author": "Matthias Kretschmann ", + "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" + } +}