forked from nerdschoolbergen/build-and-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
117 lines (104 loc) · 2.26 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
113
114
115
116
117
'use strict';
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
var sassConfig = {
default: {
files: {
'src/calcApp.css': 'src/calcApp.scss'
}
}
};
var concatConfig = {
default: {
files: {
'src/script.js': [
'bower_components/jquery/dist/jquery.js',
'bower_components/bootstrap/dist/js/bootstrap.js',
'bower_components/angular/angular.js',
'src/calcApp.module.js',
'src/calcCtrl.js'
],
'src/style.css': [
'bower_components/bootstrap/dist/css/bootstrap.css',
'src/calcApp.css'
]
}
}
};
var uglifyConfig = {
default: {
files: {
'dist/script.min.js': ['src/script.js']
}
}
};
var cssminConfig = {
default: {
files: {
'dist/style.min.css': ['src/style.css']
}
}
};
var connectConfig = {
options: {
base: 'dist',
keepalive: true
},
server: {
options: {
port: process.env.PORT || 9601
}
},
local: {
options: {
hostname: 'localhost',
port: 9601,
open: true
}
}
};
var karmaConfig = {
unit: {
options: {
files: [
'bower_components/jquery/dist/jquery.js',
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'src/calcApp.module.js',
'src/calcCtrl.js',
'test/**/*.js'
],
singleRun: true,
browsers: ['PhantomJS2'],
frameworks: ['jasmine'],
//plugins: ['karma-jasmine']
}
}
};
var gruntConfig = {
sass: sassConfig,
concat: concatConfig,
uglify: uglifyConfig,
cssmin: cssminConfig,
connect: connectConfig,
karma: karmaConfig
};
grunt.initConfig(gruntConfig);
grunt.registerTask('build', [
'sass',
'concat',
'uglify',
'cssmin'
]);
grunt.registerTask('startlocal', [
'build',
'connect:local'
]);
grunt.registerTask('start', [
'build',
'connect:server'
]);
grunt.registerTask('test', [
'karma:unit'
]);
};