mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:48:13 +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"
|
className="mobile-frame"
|
||||||
ref={this.iframeRef}
|
ref={this.iframeRef}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
src={__uri('../index.html#mobileView')}
|
src={__uri('../mobile.html')}
|
||||||
></iframe>
|
></iframe>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ export default function (schema) {
|
|||||||
className="mobile-frame"
|
className="mobile-frame"
|
||||||
ref={this.iframeRef}
|
ref={this.iframeRef}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
src={__uri('../index.html#mobileView')}
|
src={__uri('../mobile.html')}
|
||||||
></iframe>
|
></iframe>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -44,43 +44,12 @@
|
|||||||
<div id="root" class="app-wrapper"></div>
|
<div id="root" class="app-wrapper"></div>
|
||||||
<script src="./mod.js"></script>
|
<script src="./mod.js"></script>
|
||||||
<script type="text/javascript">
|
<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 || [];
|
var _hmt = _hmt || [];
|
||||||
|
|
||||||
// 百度统计
|
// 百度统计
|
||||||
(function () {
|
(function () {
|
||||||
var hm = document.createElement('script');
|
var hm = document.createElement('script');
|
||||||
hm.src =
|
hm.src = 'https://hm.baidu.com/hm.js?1f80f2c9dbe21dc3af239cf9eee90f1f';
|
||||||
'https://hm.baidu.com/hm.js?1f80f2c9dbe21dc3af239cf9eee90f1f';
|
|
||||||
var s = document.getElementsByTagName('script')[0];
|
var s = document.getElementsByTagName('script')[0];
|
||||||
s.parentNode.insertBefore(hm, s);
|
s.parentNode.insertBefore(hm, s);
|
||||||
})();
|
})();
|
||||||
@ -90,7 +59,6 @@
|
|||||||
var initialState = {};
|
var initialState = {};
|
||||||
app.bootstrap(document.getElementById('root'), initialState);
|
app.bootstrap(document.getElementById('root'), initialState);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -41,34 +41,29 @@
|
|||||||
const themes = [
|
const themes = [
|
||||||
{
|
{
|
||||||
label: '默认主题',
|
label: '默认主题',
|
||||||
ns: 'a-',
|
|
||||||
value: 'default'
|
value: 'default'
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: '百度云舍',
|
label: '百度云舍',
|
||||||
ns: 'cxd-',
|
|
||||||
value: 'cxd'
|
value: 'cxd'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Dark',
|
label: 'Dark',
|
||||||
ns: 'dark-',
|
|
||||||
value: 'dark'
|
value: 'dark'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const theme = themes[localStorage.getItem('themeIndex') || 0];
|
const theme = themes[localStorage.getItem('themeIndex') || 0];
|
||||||
if (theme.value !== 'default') {
|
// mobile 下先禁掉所有外链避免影响
|
||||||
document.querySelectorAll('link[title]').forEach(item => {
|
document.querySelectorAll('link').forEach(item => {
|
||||||
item.disabled = true;
|
item.disabled = true;
|
||||||
});
|
});
|
||||||
document.querySelector(`link[title=${theme.value}]`).disabled = false;
|
document.querySelector(`link[title=${theme.value}]`).disabled = false;
|
||||||
if (theme.value === 'dark') {
|
if (theme.value === 'dark') {
|
||||||
document.querySelector('body').classList.add('dark');
|
document.querySelector('body').classList.add('dark');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
amis.require(['./mobile.tsx'], function (app) {
|
amis.require(['./mobile.tsx'], function (app) {
|
||||||
var initialState = {};
|
app.bootstrap(document.getElementById('root'), {});
|
||||||
app.bootstrap(document.getElementById('root'), initialState);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
@ -507,6 +507,13 @@ if (fis.project.currentMedia() === 'publish') {
|
|||||||
} else if (fis.project.currentMedia() === 'gh-pages') {
|
} else if (fis.project.currentMedia() === 'gh-pages') {
|
||||||
const ghPages = fis.media('gh-pages');
|
const ghPages = fis.media('gh-pages');
|
||||||
|
|
||||||
|
ghPages.match('*.scss', {
|
||||||
|
parser: fis.plugin('sass', {
|
||||||
|
sourceMap: false
|
||||||
|
}),
|
||||||
|
rExt: '.css'
|
||||||
|
});
|
||||||
|
|
||||||
ghPages.match('/docs/**.md', {
|
ghPages.match('/docs/**.md', {
|
||||||
rExt: 'js',
|
rExt: 'js',
|
||||||
isMod: true,
|
isMod: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user