Skip to content

Instantly share code, notes, and snippets.

@ChrisWren
Created December 29, 2013 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisWren/8174620 to your computer and use it in GitHub Desktop.
Save ChrisWren/8174620 to your computer and use it in GitHub Desktop.
Cabin Gruntfile for deploying to a subdir like /blog/
module.exports = function (grunt) {
grunt.initConfig({
pages: {
posts: {
src: 'posts',
dest: 'dist/blog',
layout: 'src/layouts/post.jade',
url: 'posts/:title/',
options: {
pageSrc: 'src/pages',
data: {
baseUrl: '/blog/'
},
pagination: {
postsPerPage: 2,
listPage: 'src/pages/index.jade'
}
}
}
},
compass: {
dist: {
options: {
sassDir: 'src/styles',
cssDir: 'dist/blog/styles'
}
}
},
copy: {
dist: {
files: [{
expand: true,
cwd: 'src',
dest: 'dist/blog',
src: [
'images/**',
'scripts/**',
'styles/**.css',
'styles/fonts/**',
]
}]
}
},
watch: {
pages: {
files: [
'posts/**',
'src/layouts/**',
'src/pages/**'
],
tasks: ['pages']
},
compass: {
files: ['src/styles/**'],
tasks: ['compass']
},
copy: {
files: [
'src/images/**',
'src/scripts/**',
'src/styles/**.css',
'src/styles/fonts/**'
],
tasks: ['copy']
},
dist: {
files: ['dist/blog/**'],
options: {
livereload: true
}
}
},
connect: {
dist: {
options: {
port: 5455,
hostname: '0.0.0.0',
base: 'dist',
livereload: true
}
}
},
open: {
dist: {
path: 'http://localhost:5455/blog/'
}
},
clean: {
dist: 'dist/blog'
},
'gh-pages': {
options: {
base: 'dist/blog'
},
src: ['**']
}
});
grunt.registerTask('build', [
'clean',
'pages',
'compass',
'copy'
]);
grunt.registerTask('deploy', ['build', 'gh-pages']);
grunt.registerTask('server', [
'build',
'connect',
'open',
'watch'
]);
grunt.registerTask('default', 'server');
require('load-grunt-tasks')(grunt);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment