-
Notifications
You must be signed in to change notification settings - Fork 1
/
edp-build-config.js
106 lines (90 loc) · 2.57 KB
/
edp-build-config.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
exports.input = __dirname;
var path = require( 'path' );
exports.output = path.resolve( __dirname, 'output' );
var moduleEntries = 'html,htm,phtml,tpl,vm,js';
var pageEntries = 'html,htm,phtml,tpl,vm';
exports.getProcessors = function () {
function JsUnicodeReplacer( options ) {
AbstractProcessor.call( this, options );
}
JsUnicodeReplacer.prototype = new global.AbstractProcessor();
JsUnicodeReplacer.prototype.name = "JsUnicodeReplacer";
JsUnicodeReplacer.prototype.process = function ( file, processContext, callback ) {
if ( file.extname === 'js' ) {
file.setData( file.data.replace( /[^\x00-\xff]/g, function ( match ) {
return '\\u' + match.charCodeAt( 0 ).toString( 16 )
}) );
}
callback();
};
return [
new LessCompiler( {
entryExtnames: pageEntries
} ),
new CssCompressor(),
// new CssImporter(),
new ModuleCompiler( {
configFile: 'module.conf',
entryExtnames: moduleEntries
} ),
new JsCompressor(),
new PathMapper( {
replacements: [
{ type: 'html', tag: 'link', attribute: 'href', extnames: pageEntries },
{ type: 'html', tag: 'img', attribute: 'src', extnames: pageEntries },
{ type: 'html', tag: 'script', attribute: 'src', extnames: pageEntries },
{ extnames: moduleEntries, replacer: 'module-config' }
],
from: 'src',
to: './'
} ),
new JsUnicodeReplacer()
];
};
exports.exclude = [
'/tool',
'/doc',
'/test',
'/module.conf',
'/dep/packages.manifest',
'/dep/*/*/test',
'/dep/*/*/doc',
'/dep/*/*/demo',
'/dep/*/*/tool',
'/dep/*/*/*.md',
'/dep/*/*/package.json',
'/edp-*',
'/.edpproj',
'.svn',
'.git',
'.gitignore',
'.idea',
'.project',
'Desktop.ini',
'Thumbs.db',
'.DS_Store',
'*.tmp',
'*.bak',
'*.swp',
/* 用户自定义忽略文件 */
'README.md',
'build.sh',
'pstip.html',
'commitment.html',
'dropdownmenu.html',
'src/pstip/control.js',
'src/pstip/tip.js',
'src/commitment/control.js',
'src/commitment/tip.js',
'src/dropdownmenu/control.js',
'src/dropdownmenu/tip.js',
'src/pstiplib/control.js',
'src/pstiplib/tip.js',
'src/tangram-1.3.9.source.js',
'start.bat'
];
exports.injectProcessor = function ( processors ) {
for ( var key in processors ) {
global[ key ] = processors[ key ];
}
};