CartoAssets/Gruntfile.js

112 lines
1.9 KiB
JavaScript
Raw Normal View History

2016-01-14 19:14:43 +08:00
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
concat: {
dist: {
options: {},
files: {
'dist/cartostyles.css': [
'.tmp/src/scss/**/*.css'
]
}
}
},
2016-01-14 19:50:33 +08:00
connect: {
server: {
options: {
port: 9003,
livereload: 35732,
open: true,
hostname: '0.0.0.0', // to be able to access the server not only from localhost
base: {
path: '.'
}
}
}
},
clean: {
dist: {
files: [{
dot: true,
src: [
'.sass-cache',
'.tmp',
'dist',
'!dist/.git*'
]
}]
}
},
2016-01-14 19:14:43 +08:00
sass: {
dist: {
options: {
sourceMap: false,
outputStyle: 'compressed'
},
files: [{
expand: true,
src: [
'src/scss/**/*.scss'
],
dest: '.tmp',
ext: '.css'
}]
}
},
cssmin: {
dist: {
options: {
check: 'gzip'
},
files: {
'dist/cartostyles.css': [
'dist/cartostyles.css'
]
}
}
},
2016-01-14 19:50:33 +08:00
shell: {
dist: {
command: 'styleguide'
}
},
2016-01-14 19:14:43 +08:00
watch: {
scss: {
files: [
'src/scss/**/*.scss'
],
tasks: [
'sass',
'concat',
'cssmin'
],
options: {
spawn: false,
livereload: 35732
}
}
}
});
2016-01-14 19:50:33 +08:00
var baseTasks = [
'clean',
'sass',
'concat',
'cssmin'
];
var devTasks = baseTasks.concat([
'connect',
'watch:scss'
]);
grunt.event.on('watch', function (action, filepath) {
grunt.task.run('shell');
});
2016-01-14 19:14:43 +08:00
2016-01-14 19:50:33 +08:00
grunt.registerTask('dev', devTasks);
grunt.registerTask('build', baseTasks);
grunt.registerTask('default', baseTasks);
2016-01-14 19:52:37 +08:00
}