barebones/Gruntfile.js

97 lines
1.9 KiB
JavaScript
Raw Normal View History

2014-02-21 11:23:33 +01:00
module.exports = function(grunt) {
2014-12-04 11:16:52 +01:00
// Add your script files here in order of precedence
var scripts = [
2014-12-12 16:27:08 +01:00
'js/script.js'
2014-12-04 11:16:52 +01:00
];
2014-02-21 11:23:33 +01:00
grunt.initConfig({
2014-08-15 12:43:24 +02:00
pkg: grunt.file.readJSON('package.json'),
2014-07-24 18:44:57 +02:00
autoprefixer: {
single_file: {
options: {
browsers: ['last 10 version']
},
files: { 'style.css': 'style.css' }
}
},
2014-06-20 16:59:08 +02:00
imageoptim: {
2014-12-04 10:38:03 +01:00
src: ['img/'],
2014-06-20 16:59:08 +02:00
options: {
quitAfter: true
2014-02-21 11:23:33 +01:00
}
},
sass: {
dist: {
options: {
2014-12-12 16:14:49 +01:00
outputStyle: 'compressed'
2014-02-21 11:23:33 +01:00
},
2014-06-20 16:59:08 +02:00
files: { 'style.css': 'scss/style.scss' }
2014-02-21 11:23:33 +01:00
}
},
2014-05-08 12:24:17 +02:00
svgmin: {
options: {
plugins: [{
removeViewBox: false
}],
},
dist: {
files: [{
expand: true,
2014-12-04 10:38:03 +01:00
cwd: 'img/',
2014-05-08 12:24:17 +02:00
src: ['*.svg'],
2014-12-04 10:38:03 +01:00
dest: 'img/',
2014-05-08 12:24:17 +02:00
ext: '.svg'
}],
}
},
svg2png: {
all: {
files: [{
2014-12-04 10:38:03 +01:00
src: ['img/*.svg'],
2014-08-14 12:50:16 +02:00
dest: '.'
2014-05-08 12:24:17 +02:00
}],
}
},
uglify: {
2014-12-04 10:38:03 +01:00
options: {
mangle: false
},
2014-12-09 17:37:50 +01:00
all: {
2014-12-04 10:38:03 +01:00
files: {
2014-12-04 11:16:52 +01:00
'js/script.min.js': scripts
2014-12-04 10:38:03 +01:00
}
2014-05-08 12:24:17 +02:00
}
},
2014-02-21 11:23:33 +01:00
watch: {
css: {
2014-06-20 16:59:08 +02:00
files: ['scss/**/*.scss'],
2014-07-24 18:44:57 +02:00
tasks: ['sass', 'autoprefixer'],
2014-02-21 11:23:33 +01:00
options: {
livereload: true
}
2014-05-08 12:24:17 +02:00
},
js: {
2014-12-04 11:16:52 +01:00
files: scripts,
2014-12-04 10:38:03 +01:00
tasks: ['uglify'],
options: {
livereload: true
}
2014-02-21 11:23:33 +01:00
}
}
});
2014-07-24 18:44:57 +02:00
grunt.loadNpmTasks('grunt-autoprefixer');
2014-12-09 17:37:50 +01:00
grunt.loadNpmTasks('grunt-sass');
2014-06-20 16:59:08 +02:00
grunt.loadNpmTasks('grunt-contrib-watch');
2014-12-04 10:38:03 +01:00
grunt.loadNpmTasks('grunt-contrib-uglify');
2014-06-20 16:59:08 +02:00
grunt.loadNpmTasks('grunt-imageoptim');
2014-05-08 12:24:17 +02:00
grunt.loadNpmTasks('grunt-svg2png');
grunt.loadNpmTasks('grunt-svgmin');
2014-02-21 11:23:33 +01:00
2014-09-03 14:18:22 +02:00
grunt.registerTask('img', ['svgmin', 'svg2png', 'imageoptim']);
2014-12-04 10:38:03 +01:00
grunt.registerTask('default', ['sass', 'uglify', 'watch']);
2014-02-21 11:23:33 +01:00
2014-06-03 12:34:51 +02:00
};