forked from ichord/At.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
134 lines (120 loc) · 3.86 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
134
module.exports = (grunt) ->
# Project configuration.
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
name: 'jquery.atwho'
meta:
banner: """
/*! <%= name %> - v<%= pkg.version %> %>
* Copyright (c) <%= grunt.template.today(\"yyyy\") %> <%= pkg.author.name %> <<%=pkg.author.email%>>;
* homepage: <%= pkg.homepage %>
* Licensed <%= pkg.license %>
*/\n
"""
coffee:
dist:
options:
bare: true, join: true
files:
'dist/js/<%= name %>.js': [
'src/app.coffee',
'src/controller.coffee',
'src/textareaController.coffee',
'src/editableController.coffee',
'src/model.coffee',
'src/view.coffee',
'src/default.coffee',
'src/api.coffee'
]
specs:
files:[
{
expand: true, cwd: 'spec/javascripts', ext: ".spec.js",
src: '*.spec.coffee', dest: 'spec/build/javascripts',
},
src: 'spec/spec_helper.coffee', dest: 'spec/build/spec_helper.js'
]
umd:
all:
src: 'dist/js/<%= name %>.js'
template: 'umd'
deps:
'default': ['$']
amd: ['jquery']
cjs: ['jquery']
global:
items: ['jQuery']
prefix: ''
copy:
css: {src: 'src/jquery.atwho.css', dest: 'dist/css/jquery.atwho.css'}
concat:
options:
banner: "<%= meta.banner %>"
dist:
src: 'dist/js/<%= name %>.js', dest: 'dist/js/<%= name %>.js'
uglify:
dist:
src: 'dist/js/<%= name %>.js', dest: 'dist/js/<%= name %>.min.js'
cssmin:
minify: {src: 'src/jquery.atwho.css', dest: 'dist/css/jquery.atwho.min.css'}
watch:
css:
files: ['src/*.css']
tasks: ['copy']
coffee:
files: ['src/*.coffee', 'spec/javascripts/*.spec.coffee', 'spec/spec_helper.coffee']
tasks: ['compile', 'uglify']
test:
options:
debounceDelay: 250
files: ['src/*.coffee', 'spec/javascripts/*.spec.coffee', 'spec/spec_helper.coffee']
tasks: ['test']
jasmine:
dist:
src: 'dist/js/<%= name %>.js',
options:
keepRunner: true
styles: 'dist/css/<%= name %>.css',
specs: 'spec/build/javascripts/*.spec.js',
vendor: [
'bower_components/jquery/dist/jquery.js',
'bower_components/Caret.js/src/*.js'
],
helpers: [
'bower_components/jasmine-jquery/lib/jasmine-jquery.js',
'spec/build/spec_helper.js',
'spec/helpers/*.js'
]
connect:
tests:
options:
keepalive: true,
open:
target: 'http://localhost:8000/_SpecRunner.html'
'json-replace':
options:
space: " ",
replace:
version: "<%= pkg.version %>"
'update-version':
files:[
{src: 'bower.json', dest: 'bower.json'},
{src: 'component.json', dest: 'component.json'}
]
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-jasmine'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.loadNpmTasks 'grunt-json-replace'
grunt.loadNpmTasks 'grunt-contrib-copy'
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-contrib-cssmin'
grunt.loadNpmTasks 'grunt-umd'
# alias
grunt.registerTask 'update-version', 'json-replace'
grunt.registerTask 'compile', ['coffee', 'umd', 'concat', 'copy', 'cssmin']
grunt.registerTask "server", ["compile", "jasmine:dist:build", "connect"]
grunt.registerTask "test", ["compile", "jasmine"]
grunt.registerTask "dev", ["compile", "watch"]
grunt.registerTask "default", ['test', 'uglify', 'update-version']