Moving tasks to files

This commit is contained in:
xavijam 2016-01-14 13:57:13 +01:00
parent 27a582f5d9
commit 4b73fe68de
10 changed files with 100 additions and 89 deletions

View File

@ -1,92 +1,14 @@
module.exports = function(grunt) { module.exports = function (grunt) {
require('load-grunt-tasks')(grunt); require('load-grunt-tasks')(grunt);
grunt.initConfig({ grunt.initConfig({
concat: { concat: require('./tasks/concat'),
dist: { connect: require('./tasks/connect'),
options: {}, clean: require('./tasks/clean'),
files: { sass: require('./tasks/sass'),
'dist/cartostyles.css': [ cssmin: require('./tasks/cssmin'),
'.tmp/src/scss/**/*.css' shell: require('./tasks/shell'),
] watch: require('./tasks/watch')
}
}
},
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*'
]
}]
}
},
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'
]
}
}
},
shell: {
dist: {
command: 'styleguide'
}
},
watch: {
scss: {
files: [
'src/scss/**/*.scss'
],
tasks: [
'sass',
'concat',
'cssmin'
],
options: {
spawn: false,
livereload: 35732
}
}
}
}); });
var baseTasks = [ var baseTasks = [
@ -108,4 +30,4 @@ module.exports = function(grunt) {
grunt.registerTask('dev', devTasks); grunt.registerTask('dev', devTasks);
grunt.registerTask('build', baseTasks); grunt.registerTask('build', baseTasks);
grunt.registerTask('default', baseTasks); grunt.registerTask('default', baseTasks);
} };

View File

@ -1 +1 @@
.CDB-Shape-dot{display:inline-block;width:8px;min-width:8px;height:8px;border-radius:8px}html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}mark{background:#ff0;color:#000}sub,sup{line-height:0;position:relative}sup{top:-.5em}sub{bottom:-.25em}svg:not(:root){overflow:hidden}hr{box-sizing:content-box;height:0}pre,textarea{overflow:auto}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}optgroup{font-weight:700}a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font:inherit;vertical-align:baseline}body{margin:0;line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0} .CDB-Shape-button,.CDB-Shape-dot,.CDB-Shape-tooltip{width:8px;min-width:8px;height:8px;border-radius:8px;display:inline-block}.CDB-Shape-button,.CDB-Shape-dot,.CDB-Shape-tooltip,.u-iBlock{display:inline-block}.CDB-Shape-button{background:red}.CDB-Shape-tooltip{background:green}.u-tSpace{margin-top:4px}.u-tSpace-xl{margin-top:12px}.u-rSpace{margin-right:4px}.u-rSpace--m{margin-right:8px}.u-rSpace--xl{margin-right:12px}.u-lSpace{margin-left:4px}.u-lSpace--xl{margin-left:12px}.u-iBlock{vertical-align:middle}html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}mark{background:#ff0;color:#000}sub,sup{line-height:0;position:relative}sup{top:-.5em}sub{bottom:-.25em}svg:not(:root){overflow:hidden}hr{box-sizing:content-box;height:0}pre,textarea{overflow:auto}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}optgroup{font-weight:700}a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font:inherit;vertical-align:baseline}body{margin:0;line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}

View File

@ -43,6 +43,10 @@
"library", "library",
"CartoDB", "CartoDB",
"share", "share",
"assets" "assets",
"styleguide",
"shared components",
"editor",
"deep-insights"
] ]
} }

13
tasks/clean.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
dist: {
files: [{
dot: true,
src: [
'.sass-cache',
'.tmp',
'dist',
'!dist/.git*'
]
}]
}
};

10
tasks/concat.js Normal file
View File

@ -0,0 +1,10 @@
module.exports = {
dist: {
options: {},
files: {
'dist/cartostyles.css': [
'.tmp/src/scss/**/*.css'
]
}
}
};

13
tasks/connect.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
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: '.'
}
}
}
};

12
tasks/cssmin.js Normal file
View File

@ -0,0 +1,12 @@
module.exports = {
dist: {
options: {
check: 'gzip'
},
files: {
'dist/cartostyles.css': [
'dist/cartostyles.css'
]
}
}
};

16
tasks/sass.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
dist: {
options: {
sourceMap: false,
outputStyle: 'compressed'
},
files: [{
expand: true,
src: [
'src/scss/**/*.scss'
],
dest: '.tmp',
ext: '.css'
}]
}
};

5
tasks/shell.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
dist: {
command: 'styleguide'
}
};

16
tasks/watch.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
scss: {
files: [
'src/scss/**/*.scss'
],
tasks: [
'sass',
'concat',
'cssmin'
],
options: {
spawn: false,
livereload: 35732
}
}
};