ethstats-server/Gruntfile.js

195 lines
4.1 KiB
JavaScript
Raw Normal View History

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 = [
'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: {
2018-12-03 13:24:39 +01:00
build: ['dist'],
2018-12-03 13:38:41 +01:00
js: ['dist/js/*.*', '!dist/js/netstats.*'],
css: ['dist/css/*.css', '!dist/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'
}
},
build_pow: {
options: {
data: {
debug: false,
pretty: true
}
},
files: {
'dist/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:38:41 +01:00
src: ['*.*'],
2018-12-03 13:24:39 +01:00
dest: 'dist/fonts/',
filter: 'isFile'
},
{
expand: true,
2018-12-03 13:24:39 +01:00
cwd: 'src/images/',
2018-12-03 21:07:10 +01:00
src: ['*.*'],
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/',
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'
}
]
},
build_pow: {
files: [
{
expand: true,
2018-12-03 20:36:05 +01:00
cwd: 'src/fonts/',
2018-12-03 14:15:49 +01:00
src: ['*.*'],
dest: 'dist/fonts/',
filter: 'isFile'
},
{
expand: true,
2018-12-03 20:36:05 +01:00
cwd: 'src/images/',
2018-12-03 21:07:10 +01:00
src: ['*.*'],
dest: 'dist/',
2015-05-12 17:02:51 +02:00
filter: 'isFile'
},
{
expand: true,
cwd: 'src/pow/css/',
2018-12-03 13:42:16 +01:00
src: styles,
dest: 'dist/css/',
2015-05-12 17:02:51 +02:00
filter: 'isFile'
},
{
2015-05-19 14:59:29 +02:00
expand: true,
2018-12-03 20:36:05 +01:00
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
}
]
}
},
cssmin: {
2018-12-03 13:24:39 +01:00
build: {
files: [{
expand: true,
2018-12-03 13:24:39 +01:00
cwd: 'dist/css',
src: ['*.css', '!*.min.css'],
2018-12-03 13:24:39 +01:00
dest: 'dist/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'
2015-05-12 17:02:51 +02:00
}
},
uglify: {
2018-12-03 13:24:39 +01:00
app: {
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 %>']
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:38:41 +01:00
grunt.registerTask('default', ['clean:build', 'clean:js', 'clean:css', 'jade:build', 'copy:build', 'cssmin:build', 'concat:vendor', 'concat:scripts', 'uglify:app', 'concat:netstats', 'concat:css', 'clean:js', 'clean:css']);
2018-12-03 20:44:14 +01:00
grunt.registerTask('pow', ['clean:build', 'clean:js', 'clean:css', 'jade:build_pow', 'copy:build_pow', 'cssmin:build', 'concat:vendor', 'concat:scripts', 'uglify:app', 'concat:netstats', 'concat:css', 'clean:js', 'clean:css']);
grunt.registerTask('poa', 'default');
2015-12-04 19:39:45 +01:00
};