This repository has been archived by the owner on May 21, 2020. It is now read-only.
forked from tinymce/tinymce
-
Notifications
You must be signed in to change notification settings - Fork 4
/
GruntFileWordClean.js
92 lines (85 loc) · 2.3 KB
/
GruntFileWordClean.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
const fs = require('fs');
const start = fs.readFileSync('./standalone/wrappers/wrap.start');
const end = fs.readFileSync('./standalone/wrappers/wrap.end');
const stylesEnd = fs.readFileSync('./standalone/wrappers/wrap.styles.end');
const swag = require('@ephox/swag');
/*global module:false*/
module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-requirejs");
require('load-grunt-tasks')(grunt);
grunt.initConfig({
shell: {
tsc: { command: 'node ./node_modules/typescript/bin/tsc' }
},
uglify: {
options: {
compress: {
dead_code: true
}
},
my_target: {
files: {
'standalone/WordFilter.min.js': ['standalone/WordFilter.js'],
'standalone/Styles.min.js': ['standalone/Styles.js'],
}
}
},
rollup: {
core: {
options: {
treeshake: true,
moduleName: 'tinymceWordPasteFilter',
format: 'iife',
banner: start,
footer: end,
plugins: [
swag.nodeResolve({
basedir: __dirname,
prefixes: {
'tinymce/core': 'lib/core/main/ts',
}
}),
swag.remapImports()
]
},
files:[
{
src: 'lib/plugins/paste/main/ts/core/WordFilter.js',
dest: 'standalone/WordFilter.js'
}
]
},
styles: {
options: {
treeshake: true,
moduleName: 'tinyMceStyleParser',
format: 'iife',
banner: start,
footer: stylesEnd,
plugins: [
swag.nodeResolve({
basedir: __dirname,
prefixes: {
'tinymce/core': 'lib/core/main/ts'
}
}),
swag.remapImports()
]
},
files:[
{
src: 'lib/core/main/ts/html/Styles.js',
dest: 'standalone/Styles.js'
}
]
}
},
});
grunt.registerTask(
'build', [
'shell:tsc',
'rollup',
// 'uglify' - won't uglify this by default now; let dependent projects handle it
]
);
};