-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathGruntfile.js
129 lines (127 loc) · 3.97 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
module.exports = function (grunt) {
grunt.initConfig({
coffeelint: {
app: ['lib/*.coffee'],
options: {
max_line_length: {
level: 'ignore'
},
line_endings: {
value: "unix",
level: "error"
},
no_trailing_semicolons: {
level: "ignore"
}
}
},
coffee: {
compile: {
files: [{
expand: true, // Enable dynamic expansion.
cwd: 'lib/', // Src matches are relative to this path.
src: ['**/*.coffee'], // Actual pattern(s) to match.
dest: 'lib/', // Destination path prefix.
ext: '.js' // Dest filepaths will have this extension.
}],
options: {
bare: true // Skip surrounding IIFE in compiled output.
}
}
},
concat: {
"wildpadjs": {
options: {
banner: [
'/*!',
' * Wildpad is an open-source, collaborative code and text editor. It was designed',
' * to be embedded inside larger applications. Since it uses Wilddog as a backend,',
' * it requires no server-side code and can be added to any web app simply by',
' * including a couple JavaScript files.',
' *',
' * Wildpad 0.0.0',
' * http://wildpad.wilddogapp.com/',
' * License: MIT',
' * Copyright: 2015 Wilddog',
' * With code from ot.js (Copyright 2012-2013 Tim Baumann)',
' */\n',
'(function (name, definition, context) {',
' //try CommonJS, then AMD (require.js), then use global.',
' if (typeof module != \'undefined\' && module.exports) module.exports = definition();',
' else if (typeof context[\'define\'] == \'function\' && context[\'define\'][\'amd\']) define(definition);',
' else context[name] = definition();',
'})(\'Wildpad\', function () {'
].join('\n'),
footer: "\nreturn wildpad.Wildpad; }, this);"
},
"src": [
"lib/utils.js",
"lib/span.js",
"lib/text-op.js",
"lib/text-operation.js",
"lib/annotation-list.js",
"lib/cursor.js",
"lib/Wilddog-adapter.js",
"lib/rich-text-toolbar.js",
"lib/wrapped-operation.js",
"lib/undo-manager.js",
"lib/client.js",
"lib/editor-client.js",
"lib/ace-adapter.js",
"lib/constants.js",
"lib/entity-manager.js",
"lib/entity.js",
"lib/rich-text-codemirror.js",
"lib/rich-text-codemirror-adapter.js",
"lib/formatting.js",
"lib/text.js",
"lib/line-formatting.js",
"lib/line.js",
"lib/parse-html.js",
"lib/serialize-html.js",
"lib/text-pieces-to-inserts.js",
"lib/headless.js",
"lib/wildpad.js"
],
"dest": "dist/wildpad.js"
}
},
uglify: {
options: {
preserveComments: "some"
},
"wildpad-min-js": {
src: "dist/wildpad.js",
dest: "dist/wildpad.min.js"
}
},
copy: {
toBuild: {
files: [
{
src: 'font/wildpad.eot',
dest: 'dist/wildpad.eot'
},
{
src: 'lib/wildpad.css',
dest: 'dist/wildpad.css'
},
]
}
},
watch: {
files: ['lib/*.js', 'lib/*.coffee', 'lib/*.css'],
tasks: ['build']
}
});
grunt.loadNpmTasks('grunt-coffeelint');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-karma');
// Tasks
grunt.registerTask('build', ['coffeelint', 'coffee', 'concat', 'uglify', 'copy'])
grunt.registerTask('default', ['build']);
};