Compare commits
2 Commits
4ee023d68f
...
98dac11ece
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98dac11ece | ||
|
|
b091693221 |
@@ -22,4 +22,4 @@ npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
- 在浏览器访问 http://localhost:3000
|
||||
- 在浏览器访问 http://localhost:3000/alisurvey
|
||||
|
||||
@@ -7,7 +7,7 @@ import "./index.css";
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
<BrowserRouter>
|
||||
<BrowserRouter basename={import.meta.env.BASE_URL}>
|
||||
<App />
|
||||
<Toaster />
|
||||
</BrowserRouter>
|
||||
|
||||
@@ -12,5 +12,6 @@ function getPlugins() {
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
plugins: getPlugins()
|
||||
plugins: getPlugins(),
|
||||
base: '/alisurvey',
|
||||
});
|
||||
|
||||
@@ -87,4 +87,33 @@ function rpl_enqueue_react_app_assets() {
|
||||
'6.7.2'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用黑名单模式,在 React 模板页面移除指定样式
|
||||
*/
|
||||
add_action( 'wp_enqueue_scripts', 'rpl_blacklist_specific_styles', 99 );
|
||||
function rpl_blacklist_specific_styles() {
|
||||
// 仅在 page-react-template.php 模板上执行
|
||||
if ( ! is_page_template( 'page-react-template.php' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// --- 定义要移除的样式句柄(handle)黑名单 ---
|
||||
$blacklisted_handles = [
|
||||
// colibri-page-builder
|
||||
'fancybox',
|
||||
'extend-builder-css',
|
||||
'extend_builder_-fonts',
|
||||
];
|
||||
|
||||
// 遍历黑名单并移除每个样式
|
||||
foreach ( $blacklisted_handles as $handle ) {
|
||||
wp_dequeue_style( $handle );
|
||||
}
|
||||
|
||||
// global $wp_styles;
|
||||
// echo '<pre id="test">';
|
||||
// print_r( $wp_styles->queue );
|
||||
// echo '</pre>';
|
||||
}
|
||||
Reference in New Issue
Block a user