Skip to content

Commit

Permalink
Added first version of template
Browse files Browse the repository at this point in the history
  • Loading branch information
ozasadnyy committed Jan 31, 2015
1 parent 227fab0 commit 8c90720
Show file tree
Hide file tree
Showing 21 changed files with 761 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# .gitignore for Yeoman-Jekyll projects

# Ignore hidden folders #
# This takes care of .tmp, .sass-cache, and many others #
.*/

# Ignore OS generated files #
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db

# Always-ignore files and folders #
*.diff
*.err
*.log
*.orig
*.rej
*.swn
*.swo
*.swp
._*
*~

# Ignore packages #
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Ignore for Jekyll Grunt projects #
bower_components
dist
node_modules
.tmp
Gemfile.lock
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "http://rubygems.org"

gem 'jekyll'
317 changes: 317 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
'use strict';

module.exports = function(grunt) {
// Show elapsed time after tasks run
require('time-grunt')(grunt);
// Load all Grunt tasks
require('jit-grunt')(grunt);

grunt.initConfig({
app: {
app: 'app',
dist: 'dist',
baseurl: ''
},
watch: {
sass: {
files: ['<%= app.app %>/_assets/scss/**/*.{scss,sass}'],
tasks: ['sass:server', 'autoprefixer']
},
scripts: {
files: ['<%= app.app %>/_assets/js/**/*.{js}'],
tasks: ['uglify']
},
jekyll: {
files: [
'<%= app.app %>/**/*.{html,yml,md,mkd,markdown}'
],
tasks: ['jekyll:server']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'.jekyll/**/*.{html,yml,md,mkd,markdown}',
'.tmp/<%= app.baseurl %>/css/*.css',
'.tmp/<%= app.baseurl %>/js/*.js',
'<%= app.app %>/img/**/*.{gif,jpg,jpeg,png,svg,webp}'
]
}
},
connect: {
options: {
port: 9000,
livereload: 35729,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
livereload: {
options: {
open: {
target: 'http://localhost:9000/<%= app.baseurl %>'
},
base: [
'.jekyll',
'.tmp',
'<%= app.app %>'
]
}
},
dist: {
options: {
open: {
target: 'http://localhost:9000/<%= app.baseurl %>'
},
base: [
'<%= app.dist %>',
'.tmp'
]
}
}
},
clean: {
server: [
'.jekyll',
'.tmp'
],
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= app.dist %>/*',
'!<%= app.dist %>/.git*'
]
}]
}
},
jekyll: {
options: {
config: '_config.yml,_config.build.yml',
src: '<%= app.app %>'
},
dist: {
options: {
dest: '<%= app.dist %>/<%= app.baseurl %>',
}
},
server: {
options: {
config: '_config.yml',
dest: '.jekyll/<%= app.baseurl %>'
}
}
},
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
removeEmptyAttributes: true,
minifyJS: true,
minifyCSS: true
},
files: [{
expand: true,
cwd: '<%= app.dist %>/<%= app.baseurl %>',
src: '**/*.html',
dest: '<%= app.dist %>/<%= app.baseurl %>'
}]
}
},
uglify: {
options: {
preserveComments: false
},
dist: {
files: {
'.tmp/<%= app.baseurl %>/js/scripts.js': ['<%= app.app %>/_assets/js/**/*.js']
}
}
},
sass: {
options: {
includePaths: ['bower_components/bootstrap-sass/assets/stylesheets']
},
server: {
options: {
sourceMap: true
},
files: [{
expand: true,
cwd: '<%= app.app %>/_assets/scss',
src: '**/*.{scss,sass}',
dest: '.tmp/<%= app.baseurl %>/css',
ext: '.css'
}]
},
dist: {
options: {
outputStyle: 'compressed'
},
files: [{
expand: true,
cwd: '<%= app.app %>/_assets/scss',
src: '**/*.{scss,sass}',
dest: '<%= app.dist %>/<%= app.baseurl %>/css',
ext: '.css'
}]
}
},
uncss: {
options: {
htmlroot: '<%= app.dist %>/<%= app.baseurl %>',
report: 'gzip'
},
dist: {
src: '<%= app.dist %>/<%= app.baseurl %>/**/*.html',
dest: '.tmp/<%= app.baseurl %>/css/blog.css'
}
},
autoprefixer: {
options: {
browsers: ['last 3 versions']
},
dist: {
files: [{
expand: true,
cwd: '.tmp/<%= app.baseurl %>/css',
src: '**/*.css',
dest: '.tmp/<%= app.baseurl %>/css'
}]
}
},
critical: {
dist: {
options: {
base: './',
css: [
'.tmp/<%= app.baseurl %>/css/blog.css'
],
minify: true,
width: 320,
height: 480
},
files: [{
expand: true,
cwd: '<%= app.dist %>/<%= app.baseurl %>',
src: ['**/*.html'],
dest: '<%= app.dist %>/<%= app.baseurl %>'
}]
}
},
cssmin: {
dist: {
options: {
keepSpecialComments: 0,
check: 'gzip'
},
files: [{
expand: true,
cwd: '.tmp/<%= app.baseurl %>/css',
src: ['*.css'],
dest: '.tmp/<%= app.baseurl %>/css'
}]
}
},
imagemin: {
options: {
progressive: true
},
dist: {
files: [{
expand: true,
cwd: '<%= app.dist %>/<%= app.baseurl %>/img',
src: '**/*.{jpg,jpeg,png,gif}',
dest: '<%= app.dist %>/<%= app.baseurl %>/img'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= app.dist %>/<%= app.baseurl %>/img',
src: '**/*.svg',
dest: '<%= app.dist %>/<%= app.baseurl %>/img'
}]
}
},
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '.tmp/<%= app.baseurl %>',
src: [
'css/**/*',
'js/**/*'
],
dest: '<%= app.dist %>/<%= app.baseurl %>'
}]
}
},
buildcontrol: {
dist: {
options: {
dir: '<%= app.dist %>/<%= app.baseurl %>',
remote: '[email protected]:user/repo.git',
branch: 'gh-pages',
commit: true,
push: true,
connectCommits: false
}
}
}
});

// Define Tasks
grunt.registerTask('serve', function(target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}

grunt.task.run([
'clean:server',
'jekyll:server',
'sass:server',
'autoprefixer',
'uglify',
'connect:livereload',
'watch'
]);
});

grunt.registerTask('server', function() {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve']);
});

grunt.registerTask('build', [
'clean:dist',
'jekyll:dist',
'imagemin',
'svgmin',
'sass:dist',
'uncss',
'autoprefixer',
'cssmin',
'uglify',
'critical',
'htmlmin'
]);

grunt.registerTask('deploy', [
'build',
'copy',
'buildcontrol'
]);

grunt.registerTask('default', [
'serve'
]);
};
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# optimized-jekyll-grunt
Template for optimized Jekyll project with Grunt
Template for optimized Jekyll site or blog with Grunt
=============

1. Install [Node.js](www.nodejs.org) and [Ruby](https://www.ruby-lang.org/)
2. Run `gem install bundler`
3. Install 'grunt-cli' and 'bower' globally with `npm install -g grunt-cli bower`
4. `$cd` to the directory and run `bundle install`
5. Run `npm install` to install the necessary "npm" dependencies
6. Then run `bower install` to install the front-end dependencies
7. **That's all. You template is ready**

You can find more information about project in [this article](http://o.zasadnyy.com/blog/optimized-jekyll-site-with-grunt).
4 changes: 4 additions & 0 deletions _config.build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
future: false
show_drafts: false

exclude: ['css', 'js', 'fonts']
Loading

0 comments on commit 8c90720

Please sign in to comment.