-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
83 lines (79 loc) · 2.08 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({
port: LIVERELOAD_PORT,
});
var mountFolder = function(connect, dir) {
return connect.static(require('path').resolve(dir));
};
var path = require('path');
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-cordova-ng');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-curl');
grunt.loadNpmTasks('grunt-zip');
grunt.initConfig({
connect: {
options: {
port: 1881,
hostname: '127.0.0.1',
open: false,
},
livereload: {
options: {
middleware: function(connect) {
return [
lrSnippet,
mountFolder(connect, 'www'),
];
},
},
},
},
watch: {
files: ['www/**/*.*'],
options: {
livereload: LIVERELOAD_PORT,
},
tasks: ['lint'],
},
jshint: {
all: ['www/scripts/**/*.js', 'spec/**/*.js'],
options: {
jshintrc: true,
reporter: require('jshint-stylish'),
},
},
jscs: {
src: ['www/scripts/**/*.js', 'Gruntfile.js', 'spec/**/*.js'],
options: {
config: '.jscrc',
},
},
csslint: {
src: ['www/css/**/*.css'],
},
curl: {
'./locales.zip': 'https://localise.biz:443/' +
'api/export/archive/json.zip?' +
'key=-5lbhfMgX0nnYZNpRjudqSvj4sD1bBaq&' +
'path=locale-%7B%25lang%7D.json',
},
unzip: {
'using-router': {
router: function(filepath) {
var filename = path.basename(filepath);
return 'locales/' + filename;
},
src: './locales.zip',
dest: './www/',
},
},
});
grunt.registerTask('default', ['connect', 'lang', 'test', 'watch']);
grunt.registerTask('lint', ['jshint', 'jscs', 'csslint']);
grunt.registerTask('lang', ['curl', 'unzip']);
grunt.registerTask('test', ['lint']);
grunt.registerTask('build', ['lang', 'test', 'cordova:package']);
};