forked from jamesflorentino/nanoScrollerJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrunt.js
129 lines (127 loc) · 3.51 KB
/
grunt.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
/*global module:false*/
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-yuidoc');
grunt.loadNpmTasks('grunt-jasmine-task');
grunt.loadNpmTasks('grunt-coffee');
grunt.loadNpmTasks('grunt-css');
grunt.loadNpmTasks('grunt-sizediff');
grunt.loadNpmTasks('grunt-shell');
// Project configuration.
grunt.initConfig({
dirs: {
coffeeDir: 'coffeescripts',
jsDir: 'bin/javascripts',
cssDir: 'bin/css',
testDir: 'tests'
},
pkg: '<json:nanoscroller.jquery.json>',
meta: {
unmin: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */',
min: '/*! <%= pkg.title || pkg.name %> v<%= pkg.version %> ' +
'(c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
},
concat: {
unmin: {
src: ['<banner:meta.unmin>', '<file_strip_banner:bin/javascripts/<%= pkg.name %>.js>'],
dest: '<%= dirs.jsDir %>/<%= pkg.name %>.js'
},
min: {
src: ['<banner:meta.min>', '<file_strip_banner:bin/javascripts/<%= pkg.name %>.min.js>'],
dest: '<%= dirs.jsDir %>/<%= pkg.name %>.min.js'
}
},
csslint: {
all: {
src: '<%= dirs.cssDir %>/nanoscroller.css',
rules: {
'fallback-colors': false,
'known-properties': false,
'compatible-vendor-prefixes': false,
'adjoining-classes': false,
'empty-rules': true,
'zero-units': true,
ids: true,
important: true
}
}
},
coffee: {
nano: {
src: ['<%= dirs.coffeeDir %>/*.coffee'],
dest: '<%= dirs.jsDir %>',
options: {
bare: true
}
},
tests: {
src: ['<%= dirs.testDir %>/coffeescripts/*.coffee'],
dest: '<%= dirs.testDir %>/spec'
}
},
min: {
all: {
src: ['<%= dirs.jsDir %>/<%= pkg.name %>.js'],
dest: '<%= dirs.jsDir %>/<%= pkg.name %>.min.js'
}
},
sizediff: {
all: {
files: [
'<%= dirs.jsDir %>/<%= pkg.name %>.js',
'<%= dirs.jsDir %>/<%= pkg.name %>.min.js'
]
}
},
jasmine: {
all: ['<%= dirs.testDir %>/SpecRunner.html']
},
lint: {
files: ['grunt.js']
},
watch: {
files: '<config:coffee.nano.src>',
tasks: 'default'
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
browser: true
},
globals: {
jQuery: true
}
},
shell: {
marked: {
command: 'node_modules/marked/bin/marked README.md > bin/readme.html',
stdout: true
}
},
yuidoc: {
compile: {
options: {
paths: "bin/javascripts",
outdir: "docs/"
}
}
}
});
grunt.registerTask('default', 'coffee:nano min concat:unmin concat:min csslint lint sizediff shell:marked yuidoc');
grunt.registerTask('build', 'default');
grunt.registerTask('build:tests', 'coffee:tests');
grunt.registerTask('test', 'coffee:tests jasmine');
grunt.registerTask('size', 'sizediff');
};