forked from harvesthq/chosen
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Gruntfile.coffee
135 lines (120 loc) · 3.9 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
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
module.exports = (grunt) ->
require('load-grunt-tasks')(grunt)
grunt.loadNpmTasks('grunt1.0-dom-munger') # the naming convention of the package does not allow auto-discovery.
`const sass = require('node-sass')`
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
version_tag: 'v<%= pkg.version %>'
comments: """
/*!
Chosen, a Select Box Enhancer for jQuery and Prototype
Version <%= pkg.version %>
Full source at https://github.com/jjj/chosen
Copyright (c) 2011-<%= grunt.template.today('yyyy') %> JJJ
MIT License, https://github.com/jjj/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/
\n
"""
minified_comments: "/* Chosen <%= version_tag %> | (c) 2011-<%= grunt.template.today('yyyy') %> JJJ | MIT License, https://github.com/jjj/chosen/blob/master/LICENSE.md */\n"
concat:
options:
banner: '<%= comments %>'
jquery:
src: ['docs/chosen.jquery.js']
dest: 'docs/chosen.jquery.js'
proto:
src: ['docs/chosen.proto.js']
dest: 'docs/chosen.proto.js'
css:
src: ['docs/chosen.css']
dest: 'docs/chosen.css'
copy:
main:
src: 'LICENSE.md'
dest: 'docs/'
php:
src: 'composer.json'
dest: 'docs/'
coffee:
options:
join: true
jquery:
files:
'docs/chosen.jquery.js': ['coffee/lib/select-parser.coffee', 'coffee/lib/abstract-chosen.coffee', 'coffee/chosen.jquery.coffee']
proto:
files:
'docs/chosen.proto.js': ['coffee/lib/select-parser.coffee', 'coffee/lib/abstract-chosen.coffee', 'coffee/chosen.proto.coffee']
test:
files:
'spec/public/jquery_specs.js': 'spec/jquery/*.spec.coffee'
'spec/public/proto_specs.js': 'spec/proto/*.spec.coffee'
uglify:
options:
banner: '<%= minified_comments %>'
jquery:
options:
mangle:
reserved: ['jQuery']
files:
'docs/chosen.jquery.min.js': ['docs/chosen.jquery.js']
proto:
files:
'docs/chosen.proto.min.js': ['docs/chosen.proto.js']
sass:
options:
outputStyle: 'expanded'
implementation: sass
chosen_css:
files:
'docs/chosen.css': 'sass/chosen.scss'
postcss:
options:
processors: [
require('autoprefixer')(browsers: 'last 1 version')
]
main:
src: 'docs/chosen.css'
cssmin:
options:
banner: '<%= minified_comments %>'
keepSpecialComments: 0
main:
src: 'docs/chosen.css'
dest: 'docs/chosen.min.css'
watch:
default:
files: ['coffee/**/*.coffee', 'sass/*.scss']
tasks: ['build', 'jasmine']
test:
files: ['spec/**/*.coffee']
tasks: ['jasmine']
jasmine:
jquery:
options:
vendor: [
'docs/docsupport/jquery-3.5.1.min.js'
]
specs: 'spec/public/jquery_specs.js'
src: [ 'docs/chosen.jquery.js' ]
jquery_old:
options:
vendor: [
'docs/docsupport/jquery-1.12.4.min.js'
]
specs: 'spec/public/jquery_specs.js'
src: [ 'docs/chosen.jquery.js' ]
proto:
options:
vendor: [
'docs/docsupport/prototype-1.7.0.0.js'
'node_modules/simulant/dist/simulant.umd.js'
]
specs: 'spec/public/proto_specs.js'
src: [ 'docs/chosen.proto.js' ]
grunt.loadTasks 'tasks'
grunt.registerTask 'default', ['build']
grunt.registerTask 'build', ['coffee:jquery', 'coffee:proto', 'sass', 'concat', 'uglify', 'postcss', 'cssmin', 'copy']
grunt.registerTask 'test', ['coffee', 'jasmine']
grunt.registerTask 'test:jquery', ['coffee:test', 'coffee:jquery', 'jasmine:jquery', 'jasmine:jquery_old']
grunt.registerTask 'test:proto', ['coffee:test', 'coffee:proto', 'jasmine:proto']