forked from ablanco/yith-library-web-client
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
120 lines (115 loc) · 4.2 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
/*jslint node: true */
/*global */
module.exports = function (grunt) {
"use strict";
// Project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jslint: { // configure the task
client: {
src: [
'yithwebclient/static/js/*js', 'Gruntfile.js'
],
directives: {
browser: true,
predef: [
'Ember'
]
}
}
},
bower: {
install: {
options: {
targetDir: './yithwebclient/static/vendor',
cleanTargetDir: true
}
}
},
concat: {
options: {
separator: ';',
process: function (src, filepath) {
// Remove ALL block comments, the stripBanners only removes
// the first one
src = src.replace(/\/\*[\s\S]*?\*\//g, '');
return '\n\n// Source: ' + filepath + '\n' + src;
}
},
dist: {
src: [
'yithwebclient/static/js/app.js',
'yithwebclient/static/js/objects.js',
'yithwebclient/static/js/models.js',
'yithwebclient/static/js/controllers.js',
'yithwebclient/static/js/edit-controllers.js',
'yithwebclient/static/js/views.js',
'yithwebclient/static/js/list-views.js',
'yithwebclient/static/js/edit-views.js'
],
dest: 'yith-<%= pkg.version %>.js'
},
vendor: {
src: [
'yithwebclient/static/vendor/jquery/jquery.js',
'yithwebclient/static/vendor/bootstrap/bootstrap.js',
'yithwebclient/static/vendor/pwstrength-bootstrap/pwstrength-bootstrap-1.2.1.js',
'yithwebclient/static/vendor/handlebars/handlebars.js',
'yithwebclient/static/vendor/ember/ember.js',
// FIXME concat this file makes uglify crash
// 'yithwebclient/static/vendor/ember-data/ember-data.js',
'yithwebclient/static/vendor/sjcl/sjcl.js'
],
dest: 'vendor.js'
}
},
uglify: {
options: {
banner: '/* <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> - AGPLv3 License */\n',
sourceMap: true,
sourceMapName: 'yith-<%= pkg.version %>.min.map'
},
dist: {
files: {
'yith-<%= pkg.version %>.min.js': [
'<%= concat.dist.dest %>'
]
}
},
vendor: {
files: {
'vendor.min.js': [
'<%= concat.vendor.dest %>'
]
}
}
},
shell: {
makeDir: {
command: 'mkdir -p yithwebclient/static/js/prod'
},
moveVendorFiles: {
command: 'mv vendor* yithwebclient/static/js/prod/'
},
moveFiles: {
command: 'mv yith-<%= pkg.version %>* yithwebclient/static/js/prod/'
},
makeFontDir: {
command: 'mkdir -p yithwebclient/static/vendor/fonts'
},
mvFonts: {
command: 'mv yithwebclient/static/vendor/fontawesome/FontAwesome.otf yithwebclient/static/vendor/fontawesome/*webfont* yithwebclient/static/vendor/fonts/'
}
}
});
// Load the plugins
grunt.loadNpmTasks('grunt-bower-task');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-jslint');
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('test', ['jslint']);
// Default task(s)
grunt.registerTask('default', ['jslint', 'bower', 'concat', 'uglify',
'shell']);
};