forked from futurepress/epub.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
100 lines (93 loc) · 2.99 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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
concat_sourcemap : {
'build/epub.js': ['<banner>', 'node_modules/rsvp/dist/rsvp.js', 'src/*.js', 'libs/mime-types/mime-types.js'],
'build/reader.js': ['<banner>', 'reader_src/reader.js', 'reader_src/controllers/*.js'],
'build/hooks.js': ['<banner>', 'hooks/default/*.js']
},
uglify: {
my_target: {
options: {
preserveComments: 'some',
sourceMap: true
},
files: {
'build/epub.min.js': ['build/epub.js'],
'build/reader.min.js': ['build/reader.js'],
'build/hooks.min.js': ['build/hooks.js']
}
}
},
copy: {
main: {
files: [
{src: 'build/epub.js', dest: 'reader/js/epub.min.js'},
{src: 'build/hooks.min.js', dest: 'reader/js/hooks.min.js'},
{src: 'build/reader.min.js', dest: 'reader/js/reader.min.js'},
{src: 'build/epub.min.map', dest: 'reader/js/epub.js.map'},
{src: 'build/hooks.min.map', dest: 'reader/js/hooks.js.map'},
{src: 'build/reader.js.map', dest: 'reader/js/hooks.js.map'},
{src: 'node_modules/localforage/dist/localforage.min.js', dest: 'build/libs/localforage.min.js'},
{src: 'libs/jszip/jszip.min.js', dest: 'build/libs/zip.min.js'},
{src: 'build/libs/zip.min.js', dest: 'reader/js/libs/zip.min.js'},
{src: 'node_modules/jquery/dist/jquery.min.js', dest:'reader/js/libs/jquery.min.js'},
{src: 'node_modules/screenfull/dist/screenfull.js', dest: 'reader/js/libs/screenfull.js'},
{src: 'reader_src/plugins/search.js', dest: 'reader/js/plugins/search.js'},
{src: 'reader_src/plugins/hypothesis.js', dest: 'reader/js/plugins/hypothesis.js'},
{src: 'hooks/extensions/highlight.js', dest: 'reader/js/hooks/extensions/highlight.js'}
]
},
},
jshint: {
all: ['src/**/*.js'],//, 'reader/**/*.js']
options : {
// Environments
"browser": true,
"devel": true,
"worker": true,
// Enforcing
//"maxlen": 80,
//"quotmark": "single",
"trailing": true,
"strict": false,
// Relaxing
"boss": true,
"funcscope": true,
"globalstrict": true,
"loopfunc": true,
"maxerr": 1000,
"nonstandard": true,
"sub": true,
"validthis": true,
"globals": {
"_": false,
"define" : false,
"module" : false
}
}
},
watch: {
scripts: {
files: ['src/**/*.js', 'reader/**/*.js', 'reader_src/**/*.js'],
tasks: ['concat_sourcemap', 'uglify'],
options: {
interrupt: true,
}
},
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-concat-sourcemap');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task(s).
grunt.registerTask('default', ['jshint', 'concat_sourcemap', 'uglify', 'copy']);
};