-
Notifications
You must be signed in to change notification settings - Fork 36
/
Gruntfile.js
177 lines (168 loc) · 4.82 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
options: {
curly: false, // true: force { }
eqnull: true, // true: enable something == null
eqeqeq: false, // true: force ===
immed: true, // true: immidiatly invocated fns has to be in ()
newcap: true, // true: construcotr has to have firt letter uppercased
noarg: true, // true: no arguments.caller and arguments.callee
sub: true, // true: no warning about a['something'] if a.something can be used
undef: true, // true: can't use undeclared vars
browser: true, // true: set window object and other stuff as globals
devel: true, // true: set alert,confirm,console,... as globals
boss: true, // true: allow assigments in conditions and return statements
forin: true, // true: hasOwnProperty has to be in all for..in cycles
noempty: true, // true: no empty blocks
unused: true, // true: warn about unused vars
trailing: true, // true: no trailing whitespaces
supernew: true, // true: enable 'new Constructor' instead of 'new Constructor()'
onevar: false, // true: only one var per fn
funcscope: false, // false: no 'var' in blocks
maxdepth: 5, // max nesting depth
quotmark: 'single', // single: force '
'-W041': true, // don't warn about something == false/true
'-W117': true, // don't warn about not defined vars until I refactorize bg.js
globals: {
app: true,
bg: true,
tabID: true,
chrome: false,
define: false,
require: false,
/* browser globals not recognized by browser or devel options */
requestAnimationFrame: true,
URL: true,
HTMLCollection: true
}
},
all: ['scripts/app/**/*.js', 'scripts/bgprocess/**/*.js']
},
requirejs: {
app: {
options: {
name: '../main',
baseUrl: 'scripts/app',
generateSourceMaps: true,
preserveLicenseComments: false,
optimize: 'uglify2',
waitSeconds: 0,
paths: {
jquery: '../libs/jquery.min',
underscore: '../libs/underscore.min',
backbone: '../libs/backbone.min',
text: '../text',
i18n: '../i18n',
domReady: '../domReady'
},
shim: {
jquery: {
exports: '$'
},
backbone: {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
},
underscore: {
exports: '_'
}
},
excludeShallow: ['modules/Locale', 'jquery', 'underscore', 'backbone'],
out: 'scripts/main-compiled.js'
}
},
bg: {
options: {
name: '../bgprocess',
baseUrl: 'scripts/bgprocess',
generateSourceMaps: true,
preserveLicenseComments: false,
optimize: 'uglify2',
waitSeconds: 0,
paths: {
jquery: '../libs/jquery.min',
underscore: '../libs/underscore.min',
backbone: '../libs/backbone.min',
text: '../text',
i18n: '../i18n',
md5: '../libs/md5',
domReady: '../domReady',
backboneDB: '../libs/backbone.indexDB'
},
shim: {
jquery: {
exports: '$'
},
backboneDB: {
deps: ['backbone']
},
backbone: {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
},
underscore: {
exports: '_'
},
md5: {
exports: 'CryptoJS'
}
},
excludeShallow: ['jquery', 'underscore', 'backbone', 'backboneDB'],
out: 'scripts/bgprocess-compiled.js'
}
}
},
stylus: {
compile: {
options: {
compress: false,
//imports: ['nib']
},
files: {
//'styles/options-compiled.css': 'options.styl', // 1:1 compile
'styles/main-compiled.css': [
'styles/global.styl',
'styles/feeds.styl',
'styles/articles.styl',
'styles/content.styl'
]
}
}
},
watch: {
scripts: {
files: ['styles/*.styl'],
tasks: ['stylus'],
options: {
spawn: false,
interrupt: true,
events: ['all']
},
},
},
yuidoc: {
compile: {
name: '<%= pkg.name %>',
description: '<%= pkg.description %>',
version: '<%= pkg.version %>',
url: '<%= pkg.homepage %>',
options: {
paths: ['scripts'],
/*themedir: 'path/to/custom/theme/',*/
outdir: 'docs/'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-yuidoc');
// Default task(s).
grunt.registerTask('default', ['jshint']);
grunt.registerTask('rjs', ['requirejs:app', 'requirejs:bg']);
};