Skip to content

Instantly share code, notes, and snippets.

@neysimoes
Created March 4, 2015 17:00
Show Gist options
  • Save neysimoes/a091218eea298b8cded2 to your computer and use it in GitHub Desktop.
Save neysimoes/a091218eea298b8cded2 to your computer and use it in GitHub Desktop.
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
connect: {
server: {
options: {
protocol: 'http',
port: 9001,
livereload: true,
keepalive: true
}
}
},
compass: {
dist: {
options: {
config: 'config.rb',
trace: true
}
}
},
copy: {
js: {
files: [
{expand: true, cwd: '_dev/_assets/js/', src: ['**'], dest: 'www/_assets/js/'}
]
},
html: {
files: [
{expand: true, cwd: '_dev/', src: ['*.html'], dest: 'www/'},
{expand: true, cwd: '_dev/', src: ['**/*.html'], dest: 'www/'}
]
},
img: {
files: [
{expand: true, cwd: '_dev/_assets/img/', src: ['**'], dest: 'www/_assets/img/'}
]
}
},
clean: {
dist: ['www'],
css: ['www/_assets/css'],
js: ['www/_assets/js'],
img: ['www/_assets/img'],
html: ['www/*.html'],
sprites: ['www/_assets/img/sprites', 'www/_assets/img/logos']
},
// htmlmin: {
// dist: {
// options: {
// removeComments: true,
// collapseWhitespace: true
// // removeRedundantAttributes: true
// },
// files: [{
// expand: true,
// cwd: '_dev/',
// src: ['*.html', '**/*.html'],
// dest: 'www/'
// }]
// }
// },
imagemin: {
dynamic: {
options: {
optimizationLevel: 3
},
files: [{
expand: true,
cwd: '_dev/_assets/img',
src: ['**/*.{png,jpg,gif}'],
dest: 'www/_assets/img'
}]
}
},
watch: {
css: {
files: ['_dev/_assets/scss/**', '_dev/_assets/scss/*.scss'],
tasks: ['clean:css', 'compass'],
options: {
livereload: true
}
},
js: {
files: ['_dev/_assets/js/**', '_dev/_assets/js/*.js'],
//tasks: ['clean:js', 'uglify', 'copy:js']
tasks: ['clean:js', 'copy:js'],
options: {
livereload: true
}
},
html: {
files: ['_dev/*.html', '_dev/**/*.html'],
tasks: ['clean:html', 'copy:html'],
options: {
livereload: true
}
},
img: {
files: ['_dev/_assets/img/**', '_dev/_assets/img/*'],
tasks: ['clean:img', 'imagemin', 'clean:sprites'],
options: {
livereload: true
}
}
}
});
// load tasks
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.registerTask('w', ['watch']);
// grunt.registerTask('build', ['clean', 'htmlmin', 'imagemin', 'compass', 'uglify', 'copy:js', 'copy:fonts']);
grunt.registerTask('build', ['clean', 'copy:html', 'compass', 'copy:js', 'copy:img']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment