ethstats-server/Gruntfile.js

283 lines
6.5 KiB
JavaScript
Raw Normal View History

var src = 'src/';
2015-05-12 17:02:51 +02:00
var dest = 'dist/';
var scripts = [
'src/js/app.js',
'src/js/controllers.js',
'src/js/filters.js',
'src/js/directives.js',
'src/js/script.js'
2015-05-12 17:02:51 +02:00
];
var vendor = [
2015-05-19 14:59:29 +02:00
'dist/js/lib/jquery-1.11.3.min.js',
'dist/js/lib/bootstrap.min.js',
'dist/js/lib/angular.min.js',
'dist/js/lib/ngStorage.min.js',
2015-05-19 14:59:29 +02:00
'dist/js/lib/lodash.min.js',
'dist/js/lib/d3.min.js',
'dist/js/lib/d3.tip.min.js',
'dist/js/lib/topojson.min.js',
'dist/js/lib/datamaps.min.js',
'dist/js/lib/moment.min.js',
'dist/js/lib/moment.en.min.js',
'dist/js/lib/toastr.min.js',
'dist/js/lib/jquery.sparkline.min.js',
'dist/js/lib/primus.min.js'
2015-05-12 17:02:51 +02:00
];
var styles = [
'bootstrap.min.css',
'minimal-icons-embedded.css',
'toastr.min.css',
'style.css'
];
2015-07-27 14:02:38 +02:00
var src_lite = 'src-lite/';
var dest_lite = 'dist-lite/';
var scripts_lite = [
'scr-lite/js/app.js',
'scr-lite/js/controllers.js',
'scr-lite/js/filters.js',
'scr-lite/js/directives.js',
'scr-lite/js/script.js'
];
var vendor_lite = [
'dist-lite/js/lib/jquery-1.11.3.min.js',
'dist-lite/js/lib/bootstrap.min.js',
'dist-lite/js/lib/angular.min.js',
'dist-lite/js/lib/ngStorage.min.js',
'dist-lite/js/lib/lodash.min.js',
'dist-lite/js/lib/d3.min.js',
'dist-lite/js/lib/d3.tip.min.js',
'dist-lite/js/lib/topojson.min.js',
'dist-lite/js/lib/datamaps.min.js',
'dist-lite/js/lib/moment.min.js',
'dist-lite/js/lib/moment.en.min.js',
'dist-lite/js/lib/toastr.min.js',
'dist-lite/js/lib/jquery.sparkline.min.js',
'dist-lite/js/lib/primus.min.js'
];
var styles_lite = [
'bootstrap.min.css',
'minimal-icons-embedded.css',
'toastr.min.css',
'style.css'
];
2015-05-12 17:02:51 +02:00
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
build: ['dist'],
cleanup_js: ['dist/js/*.*', '!dist/js/netstats.*'],
2015-07-27 14:02:38 +02:00
cleanup_css: ['dist/css/*.css', '!dist/css/netstats.*.css'],
build_lite: ['dist-lite'],
cleanup_js_lite: ['dist-lite/js/*.*', '!dist-lite/js/netstats.*'],
cleanup_css_lite: ['dist-lite/css/*.css', '!dist-lite/css/netstats.*.css']
2015-05-12 17:02:51 +02:00
},
jade: {
build: {
options: {
data: {
debug: false,
pretty: true
}
},
2015-07-27 14:02:38 +02:00
files: {
'dist/index.html': 'src/views/index.jade'
}
},
build_lite: {
options: {
data: {
debug: false,
pretty: true
2015-07-14 21:55:20 +02:00
}
2015-07-27 14:02:38 +02:00
},
files: {
'dist-lite/index.html': 'src-lite/views/index.jade'
}
2015-05-12 17:02:51 +02:00
}
},
copy: {
build: {
files: [
{
expand: true,
cwd: 'src/fonts/',
2015-05-12 17:02:51 +02:00
src: ['minimal-*.*'],
dest: 'dist/fonts/',
filter: 'isFile'
},
{
expand: true,
cwd: 'src/images/',
2015-05-12 17:02:51 +02:00
src: ['*.ico'],
dest: 'dist/',
filter: 'isFile'
},
{
expand: true,
cwd: 'src/css/',
2015-05-12 17:02:51 +02:00
src: styles,
dest: 'dist/css/',
filter: 'isFile'
},
{
2015-05-19 14:59:29 +02:00
expand: true,
cwd: 'src/js/lib/',
2015-05-19 14:59:29 +02:00
src: ['*.*'],
dest: 'dist/js/lib'
2015-05-12 17:02:51 +02:00
}
]
2015-07-27 14:02:38 +02:00
},
build_lite: {
files: [
{
expand: true,
cwd: 'src-lite/fonts/',
src: ['minimal-*.*'],
dest: 'dist-lite/fonts/',
filter: 'isFile'
},
{
expand: true,
cwd: 'src-lite/images/',
src: ['*.ico'],
dest: 'dist-lite/',
filter: 'isFile'
},
{
expand: true,
cwd: 'src-lite/css/',
src: styles,
dest: 'dist-lite/css/',
filter: 'isFile'
},
{
expand: true,
cwd: 'src-lite/js/lib/',
src: ['*.*'],
dest: 'dist-lite/js/lib'
}
]
2015-05-12 17:02:51 +02:00
}
},
cssmin: {
build: {
files: [{
expand: true,
cwd: 'dist/css',
src: ['*.css', '!*.min.css'],
dest: 'dist/css/'
}]
2015-07-27 14:02:38 +02:00
},
build_lite: {
files: [{
expand: true,
cwd: 'dist-lite/css',
src: ['*.css', '!*.min.css'],
dest: 'dist-lite/css/'
}]
2015-05-12 17:02:51 +02:00
}
},
concat: {
vendor: {
2015-05-19 14:59:29 +02:00
options: {
sourceMap: true,
sourceMapIncludeSources: true,
sourceMapIn: ['dist/js/lib/*.map']
},
2015-05-12 17:02:51 +02:00
src: vendor,
dest: 'dist/js/vendor.min.js'
},
scripts : {
options: {
2015-05-19 14:59:29 +02:00
separator: ';\n',
2015-05-12 17:02:51 +02:00
},
src: scripts,
dest: 'dist/js/app.js'
},
netstats: {
options: {
2015-05-19 14:59:29 +02:00
sourceMap: true,
sourceMapIncludeSources: true,
sourceMapIn: ['dist/js/vendor.min.js.map', 'dist/js/app.min.js.map']
2015-05-12 17:02:51 +02:00
},
src: ['<%= concat.vendor.dest %>', '<%= uglify.app.dest %>'],
2015-05-19 14:59:29 +02:00
dest: 'dist/js/netstats.min.js',
nonull: true,
2015-05-12 17:02:51 +02:00
},
css: {
src: ['dist/css/*.min.css', 'dist/css/*.css'],
dest: 'dist/css/netstats.min.css'
2015-07-27 14:02:38 +02:00
},
vendor_lite: {
options: {
sourceMap: true,
sourceMapIncludeSources: true,
sourceMapIn: ['dist-lite/js/lib/*.map']
},
src: vendor_lite,
dest: 'dist-lite/js/vendor.min.js'
},
scripts_lite : {
options: {
separator: ';\n',
},
src: scripts_lite,
dest: 'dist-lite/js/app.js'
},
netstats_lite: {
options: {
sourceMap: true,
sourceMapIncludeSources: true,
sourceMapIn: ['dist-lite/js/vendor.min.js.map', 'dist-lite/js/app.min.js.map']
},
src: ['<%= concat.vendor_lite.dest %>', '<%= uglify.app_lite.dest %>'],
dest: 'dist-lite/js/netstats.min.js',
nonull: true,
},
css_lite: {
src: ['dist-lite/css/*.min.css', 'dist-lite/css/*.css'],
dest: 'dist-lite/css/netstats.min.css'
2015-05-12 17:02:51 +02:00
}
},
uglify: {
app: {
options: {
mangle: false,
2015-05-19 14:59:29 +02:00
sourceMap: true,
sourceMapIncludeSources: true
2015-05-12 17:02:51 +02:00
},
dest: 'dist/js/app.min.js',
src: ['<%= concat.scripts.dest %>']
2015-07-27 14:02:38 +02:00
},
app_lite: {
options: {
mangle: false,
sourceMap: true,
sourceMapIncludeSources: true
},
dest: 'dist-lite/js/app.min.js',
src: ['<%= concat.scripts_lite.dest %>']
2015-05-12 17:02:51 +02:00
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
2015-07-27 14:02:38 +02:00
grunt.registerTask('default', ['clean:build', 'clean:cleanup_js', 'clean:cleanup_css', 'jade:build', 'copy:build', 'cssmin:build', 'concat:vendor', 'concat:scripts', 'uglify:app', 'concat:netstats', 'concat:css', 'clean:cleanup_js', 'clean:cleanup_css']);
grunt.registerTask('lite', ['clean:build_lite', 'clean:cleanup_js_lite', 'clean:cleanup_css_lite', 'jade:build_lite', 'copy:build_lite', 'cssmin:build_lite', 'concat:vendor_lite', 'concat:scripts_lite', 'uglify:app_lite', 'concat:netstats_lite', 'concat:css_lite', 'clean:cleanup_js_lite', 'clean:cleanup_css_lite']);
2015-05-12 17:02:51 +02:00
grunt.registerTask('build', 'default');
2015-07-27 15:30:04 +02:00
grunt.registerTask('all', ['default', 'lite']);
2015-05-12 17:02:51 +02:00
};