forked from blackbaud/barkbaud-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
138 lines (134 loc) · 4.39 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
127
128
129
130
131
132
133
134
135
136
137
138
/// <vs BeforeBuild='default' SolutionOpened='watch' />
/*jshint node: true */
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
buildPath: grunt.option('buildpath') || 'build',
bump: {
options: {
files: ['bower.json'],
updateConfigs: [],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['-a'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: false,
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: false,
regExp: false
}
},
// We used to use grunt-contrib-concat here but the source maps never came out right. This one works much better.
concat_sourcemap: {
options: {
sourcesContent: true,
sourceRoot: '../..'
},
app: {
files: {
'<%= buildPath %>/js/app.js': [
'bower_components/angular-gravatar/build/angular-gravatar.js',
'src/index.js',
'src/**/*.js',
'tmp/templates.js'
]
}
}
},
uglify: {
options: {
// Source map isn't perfect here, but it's serviceable. Be on the lookout for updates to this task
// in case it's fixed.
sourceMap: true,
sourceMapIncludeSources: true
},
app: {
options: {
sourceMapIn: '<%= buildPath %>/js/app.js.map'
},
src: ['<%= buildPath %>/js/app.js'],
dest: '<%= buildPath %>/js/app.min.js'
}
},
copy: {
html: {
files: [{
expand: true,
cwd: 'src',
src: ['index.html'],
dest: '<%= buildPath %>/'
}]
},
images: {
files: [{
expand: true,
cwd: 'src',
src: ['images/**'],
dest: '<%= buildPath %>/'
}]
}
},
sass: {
libs: {
options: {
style: 'compressed'
},
files: {
'<%= buildPath %>/css/app.css': 'src/scss/app.scss'
}
}
},
html2js: {
options: {
module: 'barkbaud.templates',
quoteChar: '\'',
indentString: ' ',
singleModule: true
},
main: {
src: ['src/**/*.html'],
dest: 'tmp/templates.js'
}
},
watch: {
sass: {
files: ['src/scss/*.scss'],
tasks: ['sass']
},
scripts: {
files: ['src/**/*.js'],
tasks: ['compileappscripts']
},
html: {
files: ['src/index.html'],
tasks: ['copy:html']
},
templates: {
files: ['src/**/*.html'],
tasks: ['html2js', 'compileappscripts']
}
},
skylint: {
options: {
linterUrl: 'https://sky.blackbaudcdn.net/skyux/1.4.2/js/skylint.min.js'
},
files: ['src/**/*.html']
}
});
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-concat-sourcemap');
grunt.loadNpmTasks('grunt-html2js');
grunt.loadNpmTasks('grunt-skylint');
grunt.registerTask('compileappscripts', ['concat_sourcemap:app', 'uglify:app', 'copy:js']);
grunt.registerTask('default', ['html2js', 'concat_sourcemap', 'uglify', 'sass', 'copy']);
grunt.registerTask('build', ['default']);
grunt.registerTask('buildfromsrc', ['copy:dist', 'build']);
};