forked from modxcms/tinymce-rte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
85 lines (83 loc) · 3.13 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
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
modx: grunt.file.readJSON('_build/config.json'),
copy: {
/* move files */
tinymce: {
files: [{
src: ['**/*.min.js', '**/*.gif', '**/*.png', '**/*.css'],
cwd: 'node_modules/tinymce/plugins/',
dest: 'assets/components/tinymcerte/js/vendor/tinymce/plugins/',
expand: true,
nonull: true
}, {
src: ['tinymce.min.js', 'license.txt'],
cwd: 'node_modules/tinymce/',
dest: 'assets/components/tinymcerte/js/vendor/tinymce/',
expand: true,
nonull: true
}, {
src: ['**/*.css', '**/*.gif', '**/tinymce*.*'],
cwd: 'node_modules/tinymce/skins/',
dest: 'assets/components/tinymcerte/js/vendor/tinymce/skins/',
noProcess: 'bower.json',
expand: true,
nonull: true
}, {
src: '**/*.min.js',
cwd: 'node_modules/tinymce/themes/',
dest: 'assets/components/tinymcerte/js/vendor/tinymce/themes/',
expand: true,
nonull: true
}]
}
},
curl: {
i18n: {
src: {
url: 'https://www.tiny.cloud/tinymce-services-azure/1/i18n/download?langs=ar,be,bg_BG,cs,da,de,el,es,et,fa,fi,fr_FR,he_IL,id,it,ja,nl,pl,pt_BR,ro,ru,sk,sv_SE,th_TH,uk,zh_CN',
method: 'GET'
},
dest: 'node_modules/tinymce/langs/tinymce_languages.zip'
}
},
unzip: {
i18n: {
src: 'node_modules/tinymce/langs/tinymce_languages.zip',
dest: 'assets/components/tinymcerte/js/vendor/tinymce/'
}
},
watch: {
config: {
files: [
'_build/config.json'
],
tasks: ['default']
}
},
bump: {
version: {
files: [{
src: 'core/components/tinymcerte/model/tinymcerte/tinymcerte.class.php',
dest: 'core/components/tinymcerte/model/tinymcerte/tinymcerte.class.php'
}],
options: {
replacements: [{
pattern: /version = '\d+.\d+.\d+[-a-z0-9]*'/ig,
replacement: 'version = \'' + '<%= modx.version %>' + '\''
}]
}
}
}
});
//load the packages
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-curl');
grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-zip');
grunt.renameTask('string-replace', 'bump');
//register the task
grunt.registerTask('default', ['bump', 'curl', 'unzip', 'copy']);
};