mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-01 19:38:16 +08:00
修复 gh-pages 编译生成的 html 中对部分 css 文件的 引用错误的问题
Change-Id: Ia131c4f0741bea760f17873b7d081cdc8ac5a7c6
This commit is contained in:
parent
7f454acc6b
commit
50753c8733
@ -249,7 +249,7 @@ export default class PlayGround extends React.Component {
|
||||
className="mobile-frame"
|
||||
ref={this.iframeRef}
|
||||
// @ts-ignore
|
||||
src={__uri('../index.html#mobileView')}
|
||||
src={__uri('../mobile.html')}
|
||||
></iframe>
|
||||
);
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ export default function (schema) {
|
||||
className="mobile-frame"
|
||||
ref={this.iframeRef}
|
||||
// @ts-ignore
|
||||
src={__uri('../index.html#mobileView')}
|
||||
src={__uri('../mobile.html')}
|
||||
></iframe>
|
||||
);
|
||||
}
|
||||
|
@ -44,43 +44,12 @@
|
||||
<div id="root" class="app-wrapper"></div>
|
||||
<script src="./mod.js"></script>
|
||||
<script type="text/javascript">
|
||||
if (location.hash === '#mobileView') {
|
||||
// TODO: 本来应该使用 mobile.html 的,但 gh-pages 编译时 themes 下的 scss hash 不一致导致出错,所以先和 index.html 放一起
|
||||
const themes = [
|
||||
{
|
||||
label: '默认主题',
|
||||
value: 'default'
|
||||
},
|
||||
{
|
||||
label: '百度云舍',
|
||||
value: 'cxd'
|
||||
},
|
||||
{
|
||||
label: 'Dark',
|
||||
value: 'dark'
|
||||
}
|
||||
];
|
||||
const theme = themes[localStorage.getItem('themeIndex') || 0];
|
||||
// mobile 下先禁掉所有外链避免影响
|
||||
document.querySelectorAll('link').forEach(item => {
|
||||
item.disabled = true;
|
||||
});
|
||||
document.querySelector(`link[title=${theme.value}]`).disabled = false;
|
||||
if (theme.value === 'dark') {
|
||||
document.querySelector('body').classList.add('dark');
|
||||
}
|
||||
|
||||
amis.require(['./mobile.tsx'], function (app) {
|
||||
app.bootstrap(document.getElementById('root'), {});
|
||||
});
|
||||
} else {
|
||||
var _hmt = _hmt || [];
|
||||
|
||||
// 百度统计
|
||||
(function () {
|
||||
var hm = document.createElement('script');
|
||||
hm.src =
|
||||
'https://hm.baidu.com/hm.js?1f80f2c9dbe21dc3af239cf9eee90f1f';
|
||||
hm.src = 'https://hm.baidu.com/hm.js?1f80f2c9dbe21dc3af239cf9eee90f1f';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
@ -90,7 +59,6 @@
|
||||
var initialState = {};
|
||||
app.bootstrap(document.getElementById('root'), initialState);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -41,34 +41,29 @@
|
||||
const themes = [
|
||||
{
|
||||
label: '默认主题',
|
||||
ns: 'a-',
|
||||
value: 'default'
|
||||
},
|
||||
|
||||
{
|
||||
label: '百度云舍',
|
||||
ns: 'cxd-',
|
||||
value: 'cxd'
|
||||
},
|
||||
{
|
||||
label: 'Dark',
|
||||
ns: 'dark-',
|
||||
value: 'dark'
|
||||
}
|
||||
];
|
||||
const theme = themes[localStorage.getItem('themeIndex') || 0];
|
||||
if (theme.value !== 'default') {
|
||||
document.querySelectorAll('link[title]').forEach(item => {
|
||||
// mobile 下先禁掉所有外链避免影响
|
||||
document.querySelectorAll('link').forEach(item => {
|
||||
item.disabled = true;
|
||||
});
|
||||
document.querySelector(`link[title=${theme.value}]`).disabled = false;
|
||||
if (theme.value === 'dark') {
|
||||
document.querySelector('body').classList.add('dark');
|
||||
}
|
||||
}
|
||||
|
||||
amis.require(['./mobile.tsx'], function (app) {
|
||||
var initialState = {};
|
||||
app.bootstrap(document.getElementById('root'), initialState);
|
||||
app.bootstrap(document.getElementById('root'), {});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
@ -507,6 +507,13 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
} else if (fis.project.currentMedia() === 'gh-pages') {
|
||||
const ghPages = fis.media('gh-pages');
|
||||
|
||||
ghPages.match('*.scss', {
|
||||
parser: fis.plugin('sass', {
|
||||
sourceMap: false
|
||||
}),
|
||||
rExt: '.css'
|
||||
});
|
||||
|
||||
ghPages.match('/docs/**.md', {
|
||||
rExt: 'js',
|
||||
isMod: true,
|
||||
|
Loading…
Reference in New Issue
Block a user