forked from bramstein/fontloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
82 lines (74 loc) · 2.37 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
module.exports = function (grunt) {
require('google-closure-compiler').grunt(grunt);
var extend = require('extend');
var compilerOptions = {
compilation_level: 'ADVANCED_OPTIMIZATIONS',
warning_level: 'VERBOSE',
summary_detail_level: 3,
language_in: 'ECMASCRIPT5_STRICT',
output_wrapper: '(function(){%output%}());',
use_types_for_optimization: true
};
var src = [
'polyfill.js',
'src/**/*.js',
'node_modules/cssvalue/src/**/*.js',
'node_modules/closure-fetch/src/**/*.js',
'node_modules/closure-dom/src/**/*.js',
'node_modules/fontfaceobserver/src/**/*.js'
];
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: ['build'],
exec: {
test: 'phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html',
deps: 'calcdeps -p ' + src.map(function (p) { return p.replace('**/*.js', ''); }).join(' -p ' ) + ' -p ./vendor/google/base.js -o deps > test/deps.js'
},
jshint: {
all: ['src/**/*.js'],
options: {
// ... better written as dot notation
"-W069": true,
// type definitions
"-W030": true,
// Don't make functions within loops
"-W083": true,
// Wrap the /regexp/ literal in parens to disambiguate the slash operator
"-W092": true
}
},
'closure-compiler': {
compile: {
files: {
"build/fontloader.js": src
},
options: extend({}, compilerOptions)
},
debug: {
files: {
"build/fontloader.debug.js": src
},
options: extend({}, compilerOptions, {
debug: true,
formatting: ['PRETTY_PRINT', 'PRINT_INPUT_DELIMITER']
})
}
},
concat: {
dist: {
src: ['node_modules/promis/promise.js', 'build/fontloader.js'],
dest: 'fontloader.js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('compile', ['closure-compiler:compile']);
grunt.registerTask('debug', ['closure-compiler:debug']);
grunt.registerTask('default', ['compile']);
grunt.registerTask('test', ['exec:test']);
grunt.registerTask('deps', ['exec:deps']);
grunt.registerTask('dist', ['closure-compiler:compile', 'concat:dist']);
};