mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
修复 gh-pages 在 ie 11 下的问题 (#1272)
This commit is contained in:
parent
9f765bd6b6
commit
bc5b6e38b6
@ -51,17 +51,17 @@
|
||||
document.write(
|
||||
`<link rel="stylesheet" title="default" ${
|
||||
theme !== 'default' ? 'disabled' : ''
|
||||
} href="${__uri('../scss/themes/default-ie11.css')}" />`
|
||||
} href="${__uri('../scss/themes/default-ie11.scss')}" />`
|
||||
);
|
||||
document.write(
|
||||
`<link rel="stylesheet" title="cxd" ${
|
||||
theme !== 'cxd' ? 'disabled' : ''
|
||||
} href="${__uri('../scss/themes/cxd-ie11.css')}" />`
|
||||
} href="${__uri('../scss/themes/cxd-ie11.scss')}" />`
|
||||
);
|
||||
document.write(
|
||||
`<link rel="stylesheet" title="dark" ${
|
||||
theme !== 'dark' ? 'disabled' : ''
|
||||
} href="${__uri('../scss/themes/dark-ie11.css')}" />`
|
||||
} href="${__uri('../scss/themes/dark-ie11.scss')}" />`
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
197
fis-conf.js
197
fis-conf.js
@ -61,7 +61,7 @@ fis.match('*.scss', {
|
||||
rExt: '.css'
|
||||
});
|
||||
|
||||
fis.match('*-ie11.css', {
|
||||
fis.match('*-ie11.scss', {
|
||||
postprocessor: convertSCSSIE11
|
||||
});
|
||||
|
||||
@ -113,23 +113,24 @@ fis.match('/docs/**.md', {
|
||||
parser: [
|
||||
parserMarkdown,
|
||||
function (contents, file) {
|
||||
return contents.replace(
|
||||
/\bhref=\\('|")(.+?)\\\1/g,
|
||||
function (_, quota, link) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
return contents.replace(/\bhref=\\('|")(.+?)\\\1/g, function (
|
||||
_,
|
||||
quota,
|
||||
link
|
||||
) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path.resolve(path.dirname(file.subpath), parts[0]);
|
||||
}
|
||||
|
||||
return 'href=\\' + quota + parts.join('#') + '\\' + quota;
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path.resolve(path.dirname(file.subpath), parts[0]);
|
||||
}
|
||||
|
||||
return _;
|
||||
return 'href=\\' + quota + parts.join('#') + '\\' + quota;
|
||||
}
|
||||
);
|
||||
|
||||
return _;
|
||||
});
|
||||
}
|
||||
],
|
||||
isMod: true
|
||||
@ -215,25 +216,26 @@ fis.media('dev').match('_*.scss', {
|
||||
parser: [
|
||||
parserCodeMarkdown,
|
||||
function (contents, file) {
|
||||
return contents.replace(
|
||||
/\bhref=\\('|")(.+?)\\\1/g,
|
||||
function (_, quota, link) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
return contents.replace(/\bhref=\\('|")(.+?)\\\1/g, function (
|
||||
_,
|
||||
quota,
|
||||
link
|
||||
) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path
|
||||
.resolve(path.dirname(file.subpath), parts[0])
|
||||
.replace(/^\/docs/, '');
|
||||
}
|
||||
|
||||
return 'href=\\' + quota + parts.join('#') + '\\' + quota;
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path
|
||||
.resolve(path.dirname(file.subpath), parts[0])
|
||||
.replace(/^\/docs/, '');
|
||||
}
|
||||
|
||||
return _;
|
||||
return 'href=\\' + quota + parts.join('#') + '\\' + quota;
|
||||
}
|
||||
);
|
||||
|
||||
return _;
|
||||
});
|
||||
}
|
||||
],
|
||||
release: '$0',
|
||||
@ -283,19 +285,20 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
}),
|
||||
function (contents) {
|
||||
return contents
|
||||
.replace(
|
||||
/(?:\w+\.)?\b__uri\s*\(\s*('|")(.*?)\1\s*\)/g,
|
||||
function (_, quote, value) {
|
||||
let str = quote + value + quote;
|
||||
return (
|
||||
'(function(){try {return __uri(' +
|
||||
str +
|
||||
')} catch(e) {return ' +
|
||||
str +
|
||||
'}})()'
|
||||
);
|
||||
}
|
||||
)
|
||||
.replace(/(?:\w+\.)?\b__uri\s*\(\s*('|")(.*?)\1\s*\)/g, function (
|
||||
_,
|
||||
quote,
|
||||
value
|
||||
) {
|
||||
let str = quote + value + quote;
|
||||
return (
|
||||
'(function(){try {return __uri(' +
|
||||
str +
|
||||
')} catch(e) {return ' +
|
||||
str +
|
||||
'}})()'
|
||||
);
|
||||
})
|
||||
.replace(
|
||||
/return\s+(tslib_\d+)\.__importStar\(require\(('|")(.*?)\2\)\);/g,
|
||||
function (_, tslib, quto, value) {
|
||||
@ -577,25 +580,24 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
parser: [
|
||||
parserMarkdown,
|
||||
function (contents, file) {
|
||||
return contents.replace(
|
||||
/\bhref=\\('|")(.+?)\\\1/g,
|
||||
function (_, quota, link) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
return contents.replace(/\bhref=\\('|")(.+?)\\\1/g, function (
|
||||
_,
|
||||
quota,
|
||||
link
|
||||
) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path.resolve(path.dirname(file.subpath), parts[0]);
|
||||
}
|
||||
|
||||
return (
|
||||
'href=\\' + quota + '/amis' + parts.join('#') + '\\' + quota
|
||||
);
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path.resolve(path.dirname(file.subpath), parts[0]);
|
||||
}
|
||||
|
||||
return _;
|
||||
return 'href=\\' + quota + '/amis' + parts.join('#') + '\\' + quota;
|
||||
}
|
||||
);
|
||||
|
||||
return _;
|
||||
});
|
||||
}
|
||||
]
|
||||
});
|
||||
@ -604,25 +606,26 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
parser: [
|
||||
parserCodeMarkdown,
|
||||
function (contents, file) {
|
||||
return contents.replace(
|
||||
/\bhref=\\('|")(.+?)\\\1/g,
|
||||
function (_, quota, link) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
return contents.replace(/\bhref=\\('|")(.+?)\\\1/g, function (
|
||||
_,
|
||||
quota,
|
||||
link
|
||||
) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path
|
||||
.resolve(path.dirname(file.subpath), parts[0])
|
||||
.replace(/^\/docs/, '/amis');
|
||||
}
|
||||
|
||||
return 'href=\\' + quota + parts.join('#') + '\\' + quota;
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path
|
||||
.resolve(path.dirname(file.subpath), parts[0])
|
||||
.replace(/^\/docs/, '/amis');
|
||||
}
|
||||
|
||||
return _;
|
||||
return 'href=\\' + quota + parts.join('#') + '\\' + quota;
|
||||
}
|
||||
);
|
||||
|
||||
return _;
|
||||
});
|
||||
}
|
||||
],
|
||||
isMod: true,
|
||||
@ -754,17 +757,18 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
DocCSS.getContent(),
|
||||
ExampleJs.getContent()
|
||||
].join('\n');
|
||||
source.replace(
|
||||
/\bpath\b\s*\:\s*('|")(.*?)\1/g,
|
||||
function (_, qutoa, path) {
|
||||
if (path === '*') {
|
||||
return;
|
||||
}
|
||||
|
||||
pages.push(path.replace(/^\//, ''));
|
||||
return _;
|
||||
source.replace(/\bpath\b\s*\:\s*('|")(.*?)\1/g, function (
|
||||
_,
|
||||
qutoa,
|
||||
path
|
||||
) {
|
||||
if (path === '*') {
|
||||
return;
|
||||
}
|
||||
);
|
||||
|
||||
pages.push(path.replace(/^\//, ''));
|
||||
return _;
|
||||
});
|
||||
|
||||
const contents = indexHtml.getContent();
|
||||
pages.forEach(function (path) {
|
||||
@ -807,7 +811,7 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
url: 'null',
|
||||
useHash: false
|
||||
});
|
||||
ghPages.match('{*:scss,*.jsx,*.tsx,*.ts}', {
|
||||
ghPages.match('{*.jsx,*.tsx,*.ts}', {
|
||||
moduleId: function (m, path) {
|
||||
return fis.util.md5('amis' + path);
|
||||
},
|
||||
@ -821,19 +825,20 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
|
||||
function (contents) {
|
||||
return contents
|
||||
.replace(
|
||||
/(?:\w+\.)?\b__uri\s*\(\s*('|")(.*?)\1\s*\)/g,
|
||||
function (_, quote, value) {
|
||||
let str = quote + value + quote;
|
||||
return (
|
||||
'(function(){try {return __uri(' +
|
||||
str +
|
||||
')} catch(e) {return ' +
|
||||
str +
|
||||
'}})()'
|
||||
);
|
||||
}
|
||||
)
|
||||
.replace(/(?:\w+\.)?\b__uri\s*\(\s*('|")(.*?)\1\s*\)/g, function (
|
||||
_,
|
||||
quote,
|
||||
value
|
||||
) {
|
||||
let str = quote + value + quote;
|
||||
return (
|
||||
'(function(){try {return __uri(' +
|
||||
str +
|
||||
')} catch(e) {return ' +
|
||||
str +
|
||||
'}})()'
|
||||
);
|
||||
})
|
||||
.replace(
|
||||
/return\s+(tslib_\d+)\.__importStar\(require\(('|")(.*?)\2\)\);/g,
|
||||
function (_, tslib, quto, value) {
|
||||
|
Loading…
Reference in New Issue
Block a user