forked from nytimes/ice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
147 lines (131 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
src: ['src/**/*.js'],
options: {
browser: true,
indent: 2,
white: false,
evil: true,
regexdash: true,
wsh: true,
trailing: true,
eqnull: true,
expr: true,
boss: true,
node: true,
strict: false
}
},
qunit: {
all: {
options: {
urls: ['http://localhost:8000/ice/test/test.html']
}
}
},
connect: {
server: {
options: {
base: '../'
}
}
},
concat: {
options: {
stripBanners: true,
banner: '//\n' +
'// <%= pkg.name %> - v<%= pkg.version %>\n' +
'// The MIT License\n' +
'// Copyright (c) 2012 The New York Times, CMS Group, Matthew DeLambo <[email protected]> \n' +
'//\n'
},
dist: {
src: ['lib/rangy/rangy-core.js', 'src/polyfills.js', 'src/ice.js', 'src/dom.js', 'src/bookmark.js', 'src/selection.js', 'src/icePlugin.js', 'src/icePluginManager.js', 'src/plugins/IceAddTitlePlugin/IceAddTitlePlugin.js', 'src/plugins/IceCopyPastePlugin/IceCopyPastePlugin.js', 'src/plugins/IceSmartQuotesPlugin/IceSmartQuotesPlugin.js', 'src/plugins/IceEmdashPlugin/IceEmdashPlugin.js'],
dest: 'dist/ice.js'
}
},
uglify: {
options: {
beautify : {
ascii_only : true
} ,
preserveComments: false,
banner: '//\n' +
'// <%= pkg.name %> - v<%= pkg.version %>\n' +
'// The MIT License\n' +
'// Copyright (c) 2012 The New York Times, CMS Group, Matthew DeLambo <[email protected]> \n' +
'//\n'
},
ice: {
files: {
'dist/ice.min.js': ['dist/ice.js']
}
},
icemaster: {
options: {
banner: '//\n' +
'// <%= pkg.name %> - Master\n' +
'// The MIT License\n' +
'// Copyright (c) 2012 The New York Times, CMS Group, Matthew DeLambo <[email protected]>\n' +
'//\n'
},
files: {
'ice-master.min.js': ['dist/ice.js']
}
},
tinyice: {
files: {
'dist/ice_editor_plugin.js': 'lib/tinymce/jscripts/tiny_mce/plugins/ice/editor_plugin.js'
}
},
tinysr: {
files: {
'dist/sr_editor_plugin.js': 'lib/tinymce/jscripts/tiny_mce/plugins/icesearchreplace/editor_plugin.js'
}
}
},
compress: {
gz: {
options: {
mode: 'gzip',
archive: 'ice.min.gz'
},
dest: 'dist/',
src: 'dist/ice.min.js'
},
zip: {
options: {
archive: 'dist/ice_<%= pkg.version %>.zip'
},
files: [
{src: './**', cwd: 'dist/', expand:true}
]
}
},
clean: {
build: ['dist']
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.registerTask('test', ['connect', 'qunit']);
grunt.registerTask('build', ['clean:build', 'concat', 'uglify:ice', 'uglify:icemaster', 'compress:gz', 'cp', 'compress:zip']);
grunt.registerTask('cp', function() {
cpTinyDir('ice');
//grunt.file.delete('dist/ice_editor_plugin.js');
cpTinyDir('icesearchreplace');
//grunt.file.delete('dist/sr_editor_plugin.js');
});
var cpTinyDir = function(dir) {
grunt.file.recurse('lib/tinymce/jscripts/tiny_mce/plugins/' + dir + '/', function(abspath, rootdir, subdir, filename) {
grunt.file.copy(rootdir + '/' + (subdir ? subdir + '/' : '') + filename,'dist/tinymce/plugins/' + dir + '/' + (subdir ? subdir + '/' : '') + '/' + filename);
});
};
};