From dbb67d12851f86a18d0915f04c6ab98993da6ad9 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Wed, 17 Feb 2016 09:52:13 +0100 Subject: [PATCH] Parametrize paths. --- Gruntfile.js | 19 +++++++------------ grunt-config/clean.js | 2 +- grunt-config/htmllint.js | 4 ++-- grunt-config/includeSource.js | 4 ++-- grunt-config/jscs.js | 2 +- grunt-config/jshint.js | 2 +- grunt-config/watch.js | 6 +++--- grunt-config/wiredep.js | 2 +- 8 files changed, 18 insertions(+), 23 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 5f4b606..6e07c9b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,24 +4,19 @@ module.exports = function(grunt) { require('load-grunt-tasks')(grunt); require('time-grunt')(grunt); - var appConfig = { - app: require('./bower.json'), - dist: 'dist' - }; - // Options var options = { - accountant: appConfig, + accountant: { + frontend: { + app: require('./bower.json'), + src: 'accountant/frontend/static', + dist: 'dist' + } + }, config: { src: 'grunt-config/*.js' }, - paths: { - frontend_js: [ - 'accountant/frontend/static/js/*.js' - ], - frontend_build: 'accountant/frontend/static/build' - }, 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', diff --git a/grunt-config/clean.js b/grunt-config/clean.js index f4bd18d..6d0fc1e 100644 --- a/grunt-config/clean.js +++ b/grunt-config/clean.js @@ -2,6 +2,6 @@ module.exports = { libs: [ - 'accountant/frontend/static/build' + '<%= accountant.frontend.dist %>' ] }; diff --git a/grunt-config/htmllint.js b/grunt-config/htmllint.js index d5ea36b..fd4d04f 100644 --- a/grunt-config/htmllint.js +++ b/grunt-config/htmllint.js @@ -9,8 +9,8 @@ module.exports = { 'indent-width': 2 }, src: [ - 'accountant/frontend/static/*.html', - 'accountant/frontend/static/views/*.html' + '<%= accountant.frontend.src %>/*.html', + '<%= accountant.frontend.src %>/views/*.html' ] } }; diff --git a/grunt-config/includeSource.js b/grunt-config/includeSource.js index 61dd62f..c61102c 100644 --- a/grunt-config/includeSource.js +++ b/grunt-config/includeSource.js @@ -2,12 +2,12 @@ module.exports = { options: { - basePath: 'accountant/frontend/static', + basePath: '<%= accountant.frontend.src %>', baseUrl: '' }, index: { files: { - 'accountant/frontend/static/index.html': 'accountant/frontend/static/index.html' + '<%= accountant.frontend.src %>/index.html': '<%= accountant.frontend.src %>/index.html' } } }; diff --git a/grunt-config/jscs.js b/grunt-config/jscs.js index 1059183..403e9b4 100644 --- a/grunt-config/jscs.js +++ b/grunt-config/jscs.js @@ -4,7 +4,7 @@ module.exports = { verbose: true }, frontend_js: [ - '<%= paths.frontend_js %>' + '<%= accountant.frontend.src %>/js/*.js' ], toolchain: [ 'Gruntfile.js', diff --git a/grunt-config/jshint.js b/grunt-config/jshint.js index a5029ff..1cbf45a 100644 --- a/grunt-config/jshint.js +++ b/grunt-config/jshint.js @@ -4,7 +4,7 @@ module.exports = { reporter: require('jshint-stylish') }, frontend_js: [ - '<%= paths.frontend_js %>' + '<%= accountant.frontend.src %>/js/*.js' ], toolchain: [ 'Gruntfile.js', diff --git a/grunt-config/watch.js b/grunt-config/watch.js index 11b4d51..f880e65 100644 --- a/grunt-config/watch.js +++ b/grunt-config/watch.js @@ -7,7 +7,7 @@ module.exports = { }, js: { files: [ - '<%= paths.frontend_js %>', + '<%= accountant.frontend.src %>/js/*.js %>', 'grunt-config/*.js' ], tasks: ['jsdev'] @@ -18,8 +18,8 @@ module.exports = { }, html: { files: [ - 'accountant/frontend/static/*.html', - 'accountant/frontend/static/views/*.html' + '<%= accountant.frontend.src %>/*.html', + '<%= accountant.frontend.src %>/views/*.html' ], tasks: ['htmldev'] }, diff --git a/grunt-config/wiredep.js b/grunt-config/wiredep.js index b376d79..1be217d 100644 --- a/grunt-config/wiredep.js +++ b/grunt-config/wiredep.js @@ -1,6 +1,6 @@ module.exports = { app: { - src: ['accountant/frontend/static/index.html'], + src: ['<%= accountant.frontend.src %>/index.html'], ignorePath: /\.\.\// } };