accountant-ui/Gruntfile.js
2016-10-15 11:45:39 +02:00

135 lines
3.1 KiB
JavaScript

// vim: set tw=80 ts=4 sw=4 sts=4:
'use strict';
module.exports = function(grunt) {
// Grunt plugin initialization.
// ============================
// Automagically load grunt tasks.
require('load-grunt-tasks')(grunt);
// Display duration for each task.
require('time-grunt')(grunt);
// Options
var options = {
// Application related configuration.
accountant: {
// Frontend related
frontend: {
// Application dependencies by bower.
app: require('./bower.json'),
// Source path
src: 'accountant-ui',
// Distribution path
dist: 'accountant-ui_dist'
}
},
// Grunt configurationi files.
config: {
src: 'grunt-config/*.js'
},
// Package description for NPM.
pkg: grunt.file.readJSON('package.json')
// banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %>\n' +
// '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %> */\n'
};
// Load configuration from Grunt configuration directory.
var configs = require('load-grunt-configs')(grunt, options);
// Initialize Grunt configuration.
grunt.initConfig(configs);
// Toolchain tasks.
// ================
// Manage toolchain
grunt.registerTask('toolchain', [
// NodeJS dependencies for toolchain.
'shell:npmInstall',
// Configuration file linting.
'newer:eslint:toolchain',
'newer:jsonlint:toolchain'
]);
// Backend tasks.
// ==============
grunt.registerTask('beDeps', [
// Python dependencies. Does not work in virtualenv.
// 'shell:pipInstall'
]);
// Linting
grunt.registerTask('beLint', [
// Use flake8 for python linting.
'newer:flake8'
]);
// Backend dev task.
grunt.registerTask('beDev', [
'beDeps',
'beLint'
]);
// Frontend tasks.
// ===============
// Front dependency management.
grunt.registerTask('feDeps', [
// Web assets using bower
'shell:bowerInstall',
// Inject dependencies into application.
'wiredep:app'
]);
// Linting
grunt.registerTask('feLint', [
// ECMAScript
'newer:eslint:frontend',
// HTML.
'newer:htmllint'
]);
// Frontend dev task.
grunt.registerTask('feDev', [
'feDeps',
'feLint'
]);
// Global tasks.
// =============
// Dev.
grunt.registerTask('dev', [
'toolchain',
'beDev',
'feDev'
]);
// Serve application.
grunt.registerTask('serve', [
'dev',
'bgShell:runserver',
'connect:livereload',
'watch'
]);
// Make distribution.
grunt.registerTask('dist', [
'dev',
'clean:dist',
'useminPrepare',
'copy:dist',
'copy:styles',
'cssmin:generated',
'concat:generated',
'ngAnnotate',
'uglify:generated',
'filerev',
'usemin'
]);
};