forked from bcherny/fx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.coffee
103 lines (67 loc) · 1.66 KB
/
Gruntfile.coffee
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
module.exports = (grunt) ->
pkg = require './package.json'
header = '/* fx.js ' + pkg.version + ' */\n';
# fields = ['version', 'author', 'license', 'bugs']
# build = (pkg, fields) ->
# prefix = ' * '
# suffix = '\n'
# string = '/**\n'
# tpl = (field) ->
# value = pkg[field]
# console.log 'template', field, value
# string += "#{prefix}@#{field} "
# type = typeof value
# # string, number
# if type is 'string' or type is 'number'
# string += value + suffix
# # array
# else if value.length
# string += value.join(', ') + suffix
# # object
# else
# string += '\n'
# for key, val of value
# string += prefix + '\t' + key + ': ' + val + suffix
# # package names
# string += prefix + pkg.name + suffix
# # fields
# tpl field for field in fields when typeof pkg[field] isnt 'undefined'
# string += ' */\n'
# header = build pkg, fields
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
concat:
options:
banner: header
fx:
src: ['dist/fx.min.js']
dest: 'dist/fx.min.js'
fx_scroll:
src: ['dist/fx.scroll.min.js']
dest: 'dist/fx.scroll.min.js'
jshint:
options:
browser: true
uglify:
options:
mangle:
toplevel: true
compress:
dead_code: true
unused: true
join_vars: true
comments: false
fx:
files:
'dist/fx.min.js': [
'src/annie-0.1.2.js'
'src/fx.js'
]
fx_scroll:
files:
'dist/fx.scroll.min.js': [
'src/fx.scroll.js'
]
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.registerTask 'default', ['uglify', 'concat']