forked from futurepress/epubjs-reader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
98 lines (92 loc) · 2.67 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
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: {
options: {
'sourceRoot': '../'
},
files: {
'reader/js/reader.js': ['<banner>', 'node_modules/rsvp/dist/rsvp.js', 'src/core.js', 'src/reader.js', 'src/controllers/*.js'],
}
}
},
uglify: {
reader: {
options: {
preserveComments: 'some',
sourceMap: false
},
files: {
'reader/js/reader.min.js': ['<banner>', 'node_modules/rsvp/dist/rsvp.js', 'src/core.js', 'src/reader.js', 'src/controllers/*.js'],
}
}
},
copy: {
main: {
files: [
{src: 'node_modules/localforage/dist/localforage.min.js', dest: 'reader/js/libs/localforage.min.js'},
{src: 'libs/jszip/jszip.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: 'src/plugins/search.js', dest: 'reader/js/plugins/search.js'},
{src: 'src/plugins/hypothesis.js', dest: 'reader/js/plugins/hypothesis.js'},
{src: 'hooks/extensions/highlight.js', dest: 'reader/js/hooks/extensions/highlight.js'},
{src: 'node_modules/epubjs/dist/epub.min.js', dest: 'reader/js/epub.min.js'},
{src: 'node_modules/epubjs/dist/epub.js', dest: 'reader/js/epub.js'},
// {src: 'node_modules/epubjs/build/hooks.min.js', dest: 'reader/js/hooks.min.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'],
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', ['concat_sourcemap', 'uglify', 'copy']);
};