Skip to content

Commit a803ea1

Browse files
author
Robin Frischmann
authored
Merge pull request #125 from jas-chen/patch-1
Optimize staticData
2 parents 8deb627 + 123d708 commit a803ea1

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

modules/generator/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,33 @@ function generateFile(prefixMap, pluginList, compatibility, pluginPath) {
1919
const pluginExport = `[${pluginList.join(',')}]`
2020
const prefixMapExport = JSON.stringify(prefixMap)
2121

22+
if (pluginPath === 'static') {
23+
const prefixVariables = [
24+
'var w = ["Webkit"];',
25+
'var m = ["Moz"];',
26+
'var ms = ["ms"];',
27+
'var wm = ["Webkit","Moz"];',
28+
'var wms = ["Webkit","ms"];',
29+
'var wmms = ["Webkit","Moz","ms"];',
30+
].join('\n');
31+
32+
return `${pluginImports}
33+
${prefixVariables}
34+
35+
${moduleExporter} {
36+
plugins: ${pluginExport},
37+
prefixMap: ${
38+
prefixMapExport
39+
.replace(/\["Webkit"\]/g, 'w')
40+
.replace(/\["Moz"\]/g, 'm')
41+
.replace(/\["ms"\]/g, 'ms')
42+
.replace(/\["Webkit","Moz"\]/g, 'wm')
43+
.replace(/\["Webkit","ms"\]/g, 'wms')
44+
.replace(/\["Webkit","Moz","ms"\]/g, 'wmms')
45+
}
46+
}`;
47+
}
48+
2249
return `${pluginImports}
2350
2451
${moduleExporter} {

modules/static/staticData.js

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)