-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathGruntfile.js
74 lines (70 loc) · 2.54 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
/**
* Created by Armin on 25.05.2017.
*/
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'public/javascripts/bundle.js',
dest: 'public/javascripts/bundle.min.js'
}
},
nodeunit: {
files: ['openwhisk/**/*test.js']
},
jshint: {
files: ['**/*.js', // lint all javascript files except the follow
'!Gruntfile.js',
'!node_modules/**',
'!tts-token.js',
'!stt-token.js',
'!public/javascripts/jquery.leanModal.min.js',
'!public/javascripts/bundle.js',
'!public/javascripts/bundle.min.js'],
options: {
jshintrc: '.jshintrc',
reporterOutput: "" // This is to ommit bug!
}
},
browserify: {
build: {
src: 'public/javascripts/main.js',
dest: 'public/javascripts/bundle.js'
}
},
// run once --> grunt watch
// After that every change on a file matching the patterns used bellow
// will execute the corresponding task
watch: {
/* unittest: {
files: '<%= nodeunit.files %>',
tasks: ['nodeunit']
},*/
linting: {
files: '<%= jshint.files %>',
tasks: ['jshint']
}
/*,
uglify: {
files: '<%= uglify.build.src %>',
tasks: ['uglify']
}*/
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint'); // Linter
grunt.loadNpmTasks('grunt-contrib-nodeunit'); // Test-Framework
grunt.loadNpmTasks('grunt-contrib-uglify'); // Minifier
grunt.loadNpmTasks('grunt-contrib-watch'); // Watcher (if files changed, then run condigured tasks)
grunt.loadNpmTasks('grunt-browserify'); // Convert the nodejs app to javascript which works in browsers
// (another way is to use require.js)
// Default task.
grunt.registerTask('default', ['jshint']);
grunt.registerTask('localBuild', ['jshint', 'uglify', 'browserify']);
};