Improve Grunt integration. Wiredep.

This commit is contained in:
Alexis Lahouze 2016-01-29 13:42:25 +01:00
parent a68f834006
commit aa4e2d9d6f
9 changed files with 88 additions and 12 deletions

3
.bowerrc Normal file
View File

@ -0,0 +1,3 @@
{
"directory": "accountant/frontend/static/bower_components"
}

View File

@ -2,8 +2,15 @@ module.exports = function(grunt) {
require('load-grunt-tasks')(grunt); require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt); require('time-grunt')(grunt);
var appConfig = {
app: require('./bower.json'),
dist: 'dist'
};
// Options // Options
var options = { var options = {
accountant: appConfig,
config: { config: {
src: "grunt-config/*.js" src: "grunt-config/*.js"
}, },
@ -26,14 +33,23 @@ module.exports = function(grunt) {
grunt.registerTask('generatestatic', [ grunt.registerTask('generatestatic', [
'shell:npm_install', 'shell:npm_install',
'shell:bower_install',
'wiredep:app',
]); ]);
grunt.registerTask('jsdev', [ grunt.registerTask('jsdev', [
'jshint', 'newer:jshint',
'newer:jscs'
]); ]);
grunt.registerTask('dev', [ grunt.registerTask('dev', [
'generatestatic', 'generatestatic',
'jsdev' 'jsdev'
]); ]);
grunt.registerTask('serve', [
'dev',
'bgShell:runserver',
'watch'
]);
}; };

View File

@ -5,6 +5,10 @@
"Alexis Lahouze <xals@lahouze.org>" "Alexis Lahouze <xals@lahouze.org>"
], ],
"license": "AGPL", "license": "AGPL",
"main": [
"accountant/frontend/templates/layout.html",
"accountant/frontend/static/js/app.js"
],
"ignore": [ "ignore": [
"**/.*", "**/.*",
"node_modules", "node_modules",
@ -28,6 +32,22 @@
"angular-http-auth": "~1.2.3", "angular-http-auth": "~1.2.3",
"meanie-angular-storage": "~1.1", "meanie-angular-storage": "~1.1",
"font-awesome": ">=4.5.0", "font-awesome": ">=4.5.0",
"bootbox": "~4.4.0" "bootbox": "~4.4.0",
"angular-bootstrap": "^1.1.1"
},
"overrides": {
"bootstrap": {
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js"
]
},
"font-awesome": {
"main": [
"./css/font-awesome.css",
"./fonts/*"
]
}
} }
} }

6
grunt-config/bgShell.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
runserver: {
cmd: 'python -m manage runserver',
bg: true
}
};

12
grunt-config/jscs.js Normal file
View File

@ -0,0 +1,12 @@
module.exports = {
options: {
config: '.jscsrc',
verbose: true
},
frontend_js: [
'<%= paths.frontend_js %>'
],
toolchain: [
'Gruntfile.js'
]
};

View File

@ -1,5 +1,8 @@
module.exports = { module.exports = {
npm_install: { npm_install: {
command: 'npm install' command: 'npm install'
},
bower_install: {
command: 'bower install'
} }
}; };

View File

@ -1,6 +1,13 @@
module.exports = { module.exports = {
bower: {
files: 'bower.json',
tasks: ['wiredep']
},
js: { js: {
files: '<%= paths.frontend_js %>', files: '<%= paths.frontend_js %>',
tasks: ['jshint:frontend_js', 'concat:frontend_js'] tasks: ['devjs']
},
gruntfile: {
files: ['Gruntfile.js']
} }
}; };

6
grunt-config/wiredep.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
app: {
src: ['accountant/frontend/templates/layout.html'],
ignorePath: /\.\.\//
}
};

View File

@ -3,18 +3,21 @@
"version": "0.1.0", "version": "0.1.0",
"repository": "https://git.lahouze.org/xals/accountant", "repository": "https://git.lahouze.org/xals/accountant",
"license": "AGPL-1.0", "license": "AGPL-1.0",
"dependencies": { "devDependencies": {
"grunt": "0.4.5", "grunt": "0.4.5",
"grunt-copy": "0.1.0", "grunt-bg-shell": "^2.3.1",
"grunt-contrib-clean": "0.6.0", "grunt-contrib-clean": "0.6.0",
"grunt-contrib-watch": "0.6.1",
"grunt-contrib-concat": "0.5.1", "grunt-contrib-concat": "0.5.1",
"time-grunt": "1.2.1", "grunt-contrib-jshint": "0.11.2",
"grunt-contrib-watch": "0.6.1",
"grunt-copy": "0.1.0",
"grunt-jscs": "^2.6.0",
"grunt-newer": "^1.1.1",
"grunt-shell": "1.1.2",
"grunt-wiredep": "^2.0.0",
"jshint-stylish": "2.0.0",
"load-grunt-configs": "0.4.3", "load-grunt-configs": "0.4.3",
"load-grunt-tasks": "3.2.0", "load-grunt-tasks": "3.2.0",
"grunt-shell": "1.1.2", "time-grunt": "1.2.1"
"grunt-contrib-jshint": "0.11.2", }
"jshint-stylish": "2.0.0"
},
"devDependencies": {}
} }