-
Notifications
You must be signed in to change notification settings - Fork 44
/
Gruntfile.js
126 lines (120 loc) · 4.5 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
118
119
120
121
122
123
124
125
126
module.exports = function (grunt) {
// Loading external tasks
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-compass');
grunt.loadNpmTasks('grunt-karma');
// Project configuration.
grunt.initConfig({
dist: 'build',
pkg: grunt.file.readJSON('package.json'),
watch: {
compass: {
files: [ 'static/scss/**/*.scss' ],
tasks: [ 'compass:dev' ]
},
karma: {
files: ['static/js/*.js', 'test/unit/*.js'],
tasks: ['karma:unitBackground:run'] //NOTE the :run flag
}
},
karma: {
options: {
configFile: 'config/karma.conf.js',
browsers: ['Chrome']
},
unit: {
singleRun: true
},
unitBackground: {
background: true
}
},
uglify: {
build: {
files: [
{
'static/js/<%= dist %>/tmp/external.min.js': [
'static/lib/ui-utils-custom/ui-utils.js',
'static/lib/bootstrap-tour/bootstrap-tour.js',
'static/lib/bootstrap-switch/bootstrapSwitch.js',
'static/lib/bootstrap-tour/deps/jquery.cookie.js',
'static/lib/linkedlist/linkedlist.js',
'static/lib/angular-segmentio/angular-segmentio.js'
]
},
{
'static/js/<%= dist %>/tmp/app.min.js': [
'static/js/app.js',
'static/js/controllers.js',
'static/js/directives.js',
'static/js/filters.js',
'static/js/services.js'
]
}
]
}
},
concat: {
options: {
stripBanners: true,
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
js: {
src: ['static/lib/ace/ace.min.js',
'static/lib/angular-ui-custom/angular-ui.min.js',
'static/lib/angular-ui-bootstrap-custom/ui-bootstrap-custom-tpls-0.3.0.min.js',
'static/lib/modernizr-custom/modernizr.min.js', 'static/lib/detectizr/detectizr.min.js',
'static/lib/popcorn/popcorn-complete.min.js',
'static/lib/angular-smoothscroll/dist/scripts/2d8e3100.scripts.js',
'static/js/<%= dist %>/tmp/external.min.js', 'static/js/<%= dist %>/tmp/app.min.js'],
dest: 'static/js/<%= dist %>/<%= pkg.name %>.min.js'
},
css: {
src: ['<%= compass.prod.dest %>/*.css', 'static/lib/bootstrap-switch/bootstrapSwitch.css'],
dest: 'static/css/<%= dist %>/tmp/concat.css'
}
},
cssmin: {
combine: {
files: {
'static/css/<%= dist %>/<%= pkg.name %>.min.css': ['<%= concat.css.dest %>']
}
}
},
clean: {
build: {
src: ['static/css/<%= dist %>/*', 'static/js/<%= dist %>/*'],
filter: 'isFile'
},
tmp: {
src: ['static/css/<%= dist %>/tmp/*', 'static/js/<%= dist %>/tmp/*'],
filter: 'isFile'
}
},
compass: {
dev: {
src: 'static/scss',
dest: 'static/css/build/tmp',
linecomments: true,
forcecompile: true,
debugsass: true
},
prod: {
src: 'static/scss',
dest: 'static/css/build/tmp',
outputstyle: 'compressed',
linecomments: false,
forcecompile: true,
debugsass: false
}
}
});
// Default task.
grunt.registerTask('prod', ['clean:build','uglify', 'compass:prod', 'concat', 'cssmin', 'clean:tmp']);
grunt.registerTask('default', ['prod']);
};