/
Gruntfile.js
112 lines (106 loc) · 2.92 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
* component.navigation-header
* http://github.amexpub.com/modules/component.navigation-header
*
* Copyright (c) 2013 Amex Pub. All rights reserved.
*/
'use strict';
var exec = require('child_process').exec;
module.exports = function(grunt) {
grunt.initConfig({
jsbeautifier: {
files: ["<%= jshint.all %>"],
options: {
"indent_size": 2,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"brace_style": "collapse",
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"eval_code": false,
"indent_case": false,
"unescape_strings": false,
"space_after_anon_function": true
}
},
simplemocha: {
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'tap'
},
all: {
src: 'test/**/*.js'
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'config/**/*.js',
'example/scripts/src/**/*.js',
'index.js',
'lib/**/*.js',
'routes/**/*.js',
'test/**/*.js'
]
},
copy: {
main: {
files: [
{expand: true,cwd: 'dist', src: ['**'], dest: '../../public/periodic/component.navigation-header/'},//
{expand: true,cwd: 'lib', src: ['component.navigation-header.js'], dest: '../../public/periodic/component.navigation-header/'}
]
}
},
clean: ['../../public/periodic/component.navigation-header/'],
watch: {
scripts: {
// files: '**/*.js',
files: [
'Gruntfile.js',
'lib/**/*.js',
'test/**/*.js',
'example/scripts/src/*.js',
'example/stylesheets/*.less'
],
tasks: ['lint', 'less'],
options: {
interrupt: true
}
}
},
less: {
development: {
options: {
paths: ["example/assets/css"],
yuicompress: true
},
files: {
"example/assets/css/app.css": "./public/assets/css/app.less"
}
}
}
});
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-jsbeautifier');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.registerTask('default', ['jshint', 'simplemocha']);
grunt.registerTask('lint', 'jshint');
grunt.registerTask('test', 'simplemocha');
grunt.event.on('watch', function(action, filepath, target) {
exec("browserify "+__dirname+"/example/scripts/src/main.js -o "+__dirname+"/example/scripts/example.js");
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
});
};