sogo/UI/WebServerResources/Gruntfile.js

75 lines
2.6 KiB
JavaScript
Raw Normal View History

2014-06-19 21:50:29 +02:00
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
2014-08-06 21:43:03 +02:00
includePaths: ['bower_components/foundation/scss',
'bower_components/ionic/scss']
2014-06-19 21:50:29 +02:00
},
dist: {
options: {
// outputStyle: 'compressed'
outputStyle: 'expanded'
},
files: {
'css/app.css': 'scss/app.scss',
'css/SOGoRootPage.css': 'scss/SOGoRootPage.scss',
2014-08-06 21:43:03 +02:00
'css/ContactsUI.css': 'scss/ContactsUI.scss',
'css/mobile.css': 'scss/mobile.scss'
2014-06-19 21:50:29 +02:00
}
}
},
watch: {
grunt: { files: ['Gruntfile.js'] },
sass: {
files: 'scss/**/*.scss',
tasks: ['sass']
}
}
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('build', ['sass']);
grunt.registerTask('default', ['build','watch']);
grunt.registerTask('static', function(dev) {
2014-08-06 21:43:03 +02:00
var options = {
'src': 'bower_components',
'js_dest': 'js/vendor/',
'fonts_dest': 'fonts/',
2014-08-06 21:43:03 +02:00
'min': (dev? '' : '.min')
};
var js = [
2014-08-06 21:43:03 +02:00
'<%= src %>/angular/angular<%= min %>.js',
'<%= src %>/angular-sanitize/angular-sanitize<%= min %>.js',
'<%= src %>/angular-ui-router/release/angular-ui-router<%= min %>.js',
'<%= src %>/angular-foundation/mm-foundation-tpls<%= min %>.js',
'<%= src %>/foundation/js/foundation<%= min %>.js',
'<%= src %>/ionic/release/js/ionic<%= min %>.js',
'<%= src %>/underscore/underscore-min.js'
];
for (var i = 0; i < js.length; i++) {
var src = grunt.template.process(js[i], {data: options});
2014-08-06 21:43:03 +02:00
var paths = src.split('/');
var dest = options.js_dest + paths[paths.length-1];
grunt.file.copy(src, dest);
grunt.log.ok("copy " + src + " => " + dest);
}
var fonts = grunt.file.expand(
grunt.template.process('<%= src %>/ionic/release/fonts/ionicons.*',
{data: options})
);
for (var i = 0; i < fonts.length; i++) {
var src = fonts[i];
var paths = src.split('/');
var dest = options.fonts_dest + paths[paths.length-1];
2014-08-06 21:43:03 +02:00
grunt.file.copy(src, dest);
grunt.log.ok("copy " + src + " => " + dest);
}
});
2014-06-19 21:50:29 +02:00
}