Skip to content

Instantly share code, notes, and snippets.

@endtwist
Created December 30, 2013 22:29
Show Gist options
  • Save endtwist/8189330 to your computer and use it in GitHub Desktop.
Save endtwist/8189330 to your computer and use it in GitHub Desktop.
module.exports = function(grunt) {
grunt.initConfig({
clean: {
build: [
'build'
]
},
copy: {
dist: {
expand: true,
src: [ 'site/**/*', 'panel/**/*', 'kirby/**/*', 'content/**/*', 'assets/**/*', '*.php', '.htaccess' ],
dest: 'build/'
}
},
jshint: {
assets: {
files: {
src: [ 'assets/js/*.js', 'Gruntfile.js' ]
},
options: {
ignores: [ 'assets/js/waypoints.min.js', 'assets/js/waypoints-sticky.min.js' ]
}
}
},
watch: {
js: {
files: [
'assets/js/**/*.js'
],
tasks: [
'jshint:assets'
]
},
sass: {
files: [
'assets/sass/**/*.scss'
],
tasks: [
'compass:dev'
]
}
},
compass: {
dev: {
options: {
sassDir: 'assets/sass',
cssDir: 'assets/styles',
environment: 'development',
outputStyle: 'expanded',
require: 'susy'
}
},
dist: {
options: {
sassDir: 'build/assets/sass',
cssDir: 'build/assets/styles',
environment: 'production',
outputStyle: 'compressed',
require: 'susy',
force: true
}
}
},
imagemin: {
dist: {
options: {
optimizationLevel: 5
},
files: [
{
expand: true,
cwd: 'build/',
src: [ '**/*.{jpg,png}' ],
dest: 'build/'
}
]
}
},
uglify: {
dist: {
files: {
'build/assets/js/g.min.js': [
'build/assets/js/jquery-zload.min.js',
'build/assets/js/waypoints.min.js',
'build/assets/js/waypoints-sticky.min.js',
'build/assets/js/g.js'
]
}
}
},
processhtml: {
dist: {
files: { 'build/site/snippets/footer.php': [ 'build/site/snippets/footer.php' ] }
}
},
hashres: {
js: {
src: [
'build/assets/js/g.min.js'
],
dest: 'build/site/snippets/footer.php'
},
css: {
src: [
'build/assets/styles/screen.css'
],
dest: 'build/site/snippets/header.php'
}
},
checkrepo: {
deploy: {
clean: true
}
},
bumpup: 'package.json',
tagrelease: {
file: 'package.json',
commit: true,
message: 'Release %version%',
prefix: 'v',
annotate: false
},
gitpush: {
deploy: {
options: {
remote: 'production',
branch: 'master'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-hashres');
grunt.loadNpmTasks('grunt-processhtml');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-checkrepo');
grunt.loadNpmTasks('grunt-tagrelease');
grunt.loadNpmTasks('grunt-bumpup');
grunt.loadNpmTasks('grunt-git');
grunt.registerTask('default', [
'jshint:assets',
'compass:dev'
]);
grunt.registerTask('build', [
'clean:build',
'jshint:assets',
'copy:dist',
'compass:dist',
'imagemin:dist',
'uglify:dist',
'processhtml:dist',
'hashres'
]);
grunt.registerTask('deploy', [
'checkrepo:deploy',
'build',
'bumpup:patch',
'tagrelease',
'gitpush:deploy'
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment