2018-12-03 13:24:39 +01:00
|
|
|
var src = 'src/';
|
|
|
|
var dest = 'dist/';
|
2015-05-12 17:02:51 +02:00
|
|
|
|
2018-12-03 13:24:39 +01:00
|
|
|
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
|
|
|
];
|
|
|
|
|
2018-12-03 13:24:39 +01:00
|
|
|
var vendor = [
|
|
|
|
'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',
|
|
|
|
'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
|
|
|
];
|
|
|
|
|
2018-12-03 13:24:39 +01:00
|
|
|
var styles = [
|
2018-12-03 13:11:51 +01:00
|
|
|
'bootstrap.min.css',
|
|
|
|
'minimal-icons-embedded.css',
|
|
|
|
'toastr.min.css',
|
|
|
|
'style.css'
|
|
|
|
];
|
|
|
|
|
|
|
|
var src_pow = 'src/pow/';
|
|
|
|
var dest_pow = 'dist/pow/';
|
|
|
|
|
|
|
|
var styles_pow = [
|
2015-05-12 17:02:51 +02:00
|
|
|
'bootstrap.min.css',
|
|
|
|
'minimal-icons-embedded.css',
|
|
|
|
'toastr.min.css',
|
|
|
|
'style.css'
|
|
|
|
];
|
|
|
|
|
|
|
|
module.exports = function(grunt) {
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
clean: {
|
2018-12-03 13:24:39 +01:00
|
|
|
build: ['dist'],
|
|
|
|
cleanup_js: ['dist/js/*.*', '!dist/js/netstats.*'],
|
|
|
|
cleanup_css: ['dist/css/*.css', '!dist/css/netstats.*.css'],
|
2018-12-03 13:11:51 +01:00
|
|
|
build_pow: ['dist/pow'],
|
|
|
|
cleanup_js_pow: ['dist/pow/js/*.*', '!dist/pow/js/netstats.*'],
|
|
|
|
cleanup_css_pow: ['dist/pow/css/*.css', '!dist/pow/css/netstats.*.css']
|
2015-05-12 17:02:51 +02:00
|
|
|
},
|
|
|
|
jade: {
|
2018-12-03 13:24:39 +01:00
|
|
|
build: {
|
2015-05-12 17:02:51 +02:00
|
|
|
options: {
|
|
|
|
data: {
|
|
|
|
debug: false,
|
|
|
|
pretty: true
|
|
|
|
}
|
|
|
|
},
|
2015-07-27 14:02:38 +02:00
|
|
|
files: {
|
2018-12-03 13:24:39 +01:00
|
|
|
'dist/index.html': 'src/views/index.jade'
|
2018-12-03 13:11:51 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
build_pow: {
|
|
|
|
options: {
|
|
|
|
data: {
|
|
|
|
debug: false,
|
|
|
|
pretty: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
'dist/pow/index.html': 'src/pow/views/index.jade'
|
2015-07-27 14:02:38 +02:00
|
|
|
}
|
2015-05-12 17:02:51 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
copy: {
|
2018-12-03 13:24:39 +01:00
|
|
|
build: {
|
2015-05-12 17:02:51 +02:00
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
2018-12-03 13:24:39 +01:00
|
|
|
cwd: 'src/fonts/',
|
2018-12-03 13:11:51 +01:00
|
|
|
src: ['minimal-*.*'],
|
2018-12-03 13:24:39 +01:00
|
|
|
dest: 'dist/fonts/',
|
2018-12-03 13:11:51 +01:00
|
|
|
filter: 'isFile'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
2018-12-03 13:24:39 +01:00
|
|
|
cwd: 'src/images/',
|
2018-12-03 13:11:51 +01:00
|
|
|
src: ['*.ico'],
|
2018-12-03 13:24:39 +01:00
|
|
|
dest: 'dist/',
|
2015-05-12 17:02:51 +02:00
|
|
|
filter: 'isFile'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
2018-12-03 13:24:39 +01:00
|
|
|
cwd: 'src/css/',
|
|
|
|
src: styles,
|
|
|
|
dest: 'dist/css/',
|
2018-12-03 13:11:51 +01:00
|
|
|
filter: 'isFile'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
2018-12-03 13:24:39 +01:00
|
|
|
cwd: 'src/js/lib/',
|
2017-09-04 06:38:22 +02:00
|
|
|
src: ['*.*'],
|
2018-12-03 13:24:39 +01:00
|
|
|
dest: 'dist/js/lib'
|
2018-12-03 13:11:51 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
build_pow: {
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'src/pow/fonts/',
|
|
|
|
src: ['minimal-*.*'],
|
|
|
|
dest: 'dist/pow/fonts/',
|
|
|
|
filter: 'isFile'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'src/pow/images/',
|
|
|
|
src: ['*.ico'],
|
|
|
|
dest: 'dist/pow/',
|
2015-05-12 17:02:51 +02:00
|
|
|
filter: 'isFile'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
2018-12-03 13:11:51 +01:00
|
|
|
cwd: 'src/pow/css/',
|
|
|
|
src: styles_pow,
|
|
|
|
dest: 'dist/pow/css/',
|
2015-05-12 17:02:51 +02:00
|
|
|
filter: 'isFile'
|
|
|
|
},
|
|
|
|
{
|
2015-05-19 14:59:29 +02:00
|
|
|
expand: true,
|
2018-12-03 13:11:51 +01:00
|
|
|
cwd: 'src/pow/js/lib/',
|
2015-05-19 14:59:29 +02:00
|
|
|
src: ['*.*'],
|
2018-12-03 13:11:51 +01:00
|
|
|
dest: 'dist/pow/js/lib'
|
2015-05-12 17:02:51 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
cssmin: {
|
2018-12-03 13:24:39 +01:00
|
|
|
build: {
|
2018-12-03 13:11:51 +01:00
|
|
|
files: [{
|
|
|
|
expand: true,
|
2018-12-03 13:24:39 +01:00
|
|
|
cwd: 'dist/css',
|
2018-12-03 13:11:51 +01:00
|
|
|
src: ['*.css', '!*.min.css'],
|
2018-12-03 13:24:39 +01:00
|
|
|
dest: 'dist/css/'
|
2018-12-03 13:11:51 +01:00
|
|
|
}]
|
|
|
|
},
|
|
|
|
build_pow: {
|
2015-05-12 17:02:51 +02:00
|
|
|
files: [{
|
|
|
|
expand: true,
|
2018-12-03 13:11:51 +01:00
|
|
|
cwd: 'dist/pow/css',
|
2015-05-12 17:02:51 +02:00
|
|
|
src: ['*.css', '!*.min.css'],
|
2018-12-03 13:11:51 +01:00
|
|
|
dest: 'dist/pow/css/'
|
2015-05-12 17:02:51 +02:00
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
concat: {
|
2018-12-03 13:24:39 +01:00
|
|
|
vendor: {
|
2015-05-19 14:59:29 +02:00
|
|
|
options: {
|
2015-12-04 19:39:45 +01:00
|
|
|
souceMap: false,
|
2015-05-19 14:59:29 +02:00
|
|
|
sourceMapIncludeSources: true,
|
2018-12-03 13:24:39 +01:00
|
|
|
sourceMapIn: ['dist/js/lib/*.map']
|
2015-05-19 14:59:29 +02:00
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
src: vendor,
|
|
|
|
dest: 'dist/js/vendor.min.js'
|
2015-05-12 17:02:51 +02:00
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
scripts : {
|
2015-05-12 17:02:51 +02:00
|
|
|
options: {
|
2015-05-19 14:59:29 +02:00
|
|
|
separator: ';\n',
|
2015-05-12 17:02:51 +02:00
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
src: scripts,
|
|
|
|
dest: 'dist/js/app.js'
|
2015-05-12 17:02:51 +02:00
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
netstats: {
|
2015-05-12 17:02:51 +02:00
|
|
|
options: {
|
2015-12-04 19:39:45 +01:00
|
|
|
sourceMap: false,
|
2015-05-19 14:59:29 +02:00
|
|
|
sourceMapIncludeSources: true,
|
2018-12-03 13:24:39 +01:00
|
|
|
sourceMapIn: ['dist/js/vendor.min.js.map', 'dist/js/app.min.js.map']
|
2015-05-12 17:02:51 +02:00
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
src: ['<%= concat.vendor.dest %>', '<%= uglify.app.dest %>'],
|
|
|
|
dest: 'dist/js/netstats.min.js',
|
2015-12-04 19:39:45 +01:00
|
|
|
nonull: true
|
2015-05-12 17:02:51 +02:00
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
css: {
|
|
|
|
src: ['dist/css/*.min.css', 'dist/css/*.css'],
|
|
|
|
dest: 'dist/css/netstats.min.css'
|
2018-12-03 13:11:51 +01:00
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
vendor: {
|
2018-12-03 13:11:51 +01:00
|
|
|
options: {
|
|
|
|
sourceMap: false,
|
|
|
|
sourceMapIncludeSources: true,
|
|
|
|
sourceMapIn: ['dist/pow/js/lib/*.map']
|
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
src: vendor,
|
2018-12-03 13:11:51 +01:00
|
|
|
dest: 'dist/pow/js/vendor.min.js'
|
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
scripts : {
|
2018-12-03 13:11:51 +01:00
|
|
|
options: {
|
|
|
|
separator: ';\n',
|
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
src: scripts,
|
2018-12-03 13:11:51 +01:00
|
|
|
dest: 'dist/pow/js/app.js'
|
|
|
|
},
|
|
|
|
netstats_pow: {
|
|
|
|
options: {
|
|
|
|
sourceMap: false,
|
|
|
|
sourceMapIncludeSources: true,
|
|
|
|
sourceMapIn: ['dist/pow/js/vendor.min.js.map', 'dist/pow/js/app.min.js.map']
|
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
src: ['<%= concat.vendor.dest %>', '<%= uglify.app_pow.dest %>'],
|
2018-12-03 13:11:51 +01:00
|
|
|
dest: 'dist/pow/js/netstats.min.js',
|
|
|
|
nonull: true,
|
|
|
|
},
|
|
|
|
css_pow: {
|
|
|
|
src: ['dist/pow/css/*.min.css', 'dist/pow/css/*.css'],
|
|
|
|
dest: 'dist/pow/css/netstats.min.css'
|
2015-05-12 17:02:51 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
uglify: {
|
2018-12-03 13:24:39 +01:00
|
|
|
app: {
|
2018-12-03 13:11:51 +01:00
|
|
|
options: {
|
|
|
|
mangle: false,
|
|
|
|
sourceMap: false,
|
|
|
|
sourceMapIncludeSources: true
|
|
|
|
},
|
2018-12-03 13:24:39 +01:00
|
|
|
dest: 'dist/js/app.min.js',
|
|
|
|
src: ['<%= concat.scripts.dest %>']
|
2018-12-03 13:11:51 +01:00
|
|
|
},
|
|
|
|
app_pow: {
|
2015-05-12 17:02:51 +02:00
|
|
|
options: {
|
|
|
|
mangle: false,
|
2015-12-04 19:39:45 +01:00
|
|
|
sourceMap: false,
|
2015-05-19 14:59:29 +02:00
|
|
|
sourceMapIncludeSources: true
|
2015-05-12 17:02:51 +02:00
|
|
|
},
|
2018-12-03 13:11:51 +01:00
|
|
|
dest: 'dist/pow/js/app.min.js',
|
2018-12-03 13:24:39 +01:00
|
|
|
src: ['<%= concat.scripts.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');
|
|
|
|
|
2018-12-03 13:24:39 +01: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('pow', ['clean:build_pow', 'clean:cleanup_js_pow', 'clean:cleanup_css_pow', 'jade:build_pow', 'copy:build_pow', 'cssmin:build_pow', 'concat:vendor', 'concat:scripts', 'uglify:app_pow', 'concat:netstats_pow', 'concat:css_pow', 'clean:cleanup_js_pow', 'clean:cleanup_css_pow']);
|
2018-12-03 13:11:51 +01:00
|
|
|
grunt.registerTask('build', 'default');
|
2018-12-03 13:24:39 +01:00
|
|
|
grunt.registerTask('all', ['default', 'pow']);
|
2015-12-04 19:39:45 +01:00
|
|
|
};
|