Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add r/webpack page #5196

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
40 changes: 22 additions & 18 deletions src/components/Sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import LoadingIcon from '../../styles/icons/loading.svg';
const versions = [5, 4];
const currentDocsVersion = 5;

const excludedPages = ['/webpack-options/'];

Sidebar.propTypes = {
className: PropTypes.string,
pages: PropTypes.array,
Expand Down Expand Up @@ -69,26 +71,28 @@ export default function Sidebar({ className = '', pages, currentPage }) {
</div>
<Print url={currentPage} />

{pages.map((page, index) => {
let displayGroup = group !== page.group && page.group !== '-';
group = page.group;
{pages
.filter((page) => excludedPages.includes(page.url) === false)
.map((page, index) => {
let displayGroup = group !== page.group && page.group !== '-';
group = page.group;

return (
<div key={page.url}>
{displayGroup ? (
<h4 className="sidebar__group">{group}</h4>
) : null}
return (
<div key={page.url}>
{displayGroup ? (
<h4 className="sidebar__group">{group}</h4>
) : null}

<SidebarItem
index={index}
url={page.url}
title={page.title}
anchors={page.anchors}
currentPage={currentPage}
/>
</div>
);
})}
<SidebarItem
index={index}
url={page.url}
title={page.title}
anchors={page.anchors}
currentPage={currentPage}
/>
</div>
);
})}
</div>
</nav>
);
Expand Down
7 changes: 7 additions & 0 deletions src/components/Site/clientSideRedirections.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,12 @@ export default function (location) {
) {
return `/configuration/cache/${location.hash}`;
}

if (location.pathname === '/webpack-options/') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe /webpack/options/ so in future we will add /webpack-dev-server/options/ and maybe more

Copy link
Member Author

@chenxsan chenxsan Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about https://webpack.js.org/webpack/?option=output/filename https://webpack.js.org/webpack-dev-server/?option=xxx? It's more terse.

Or https://webpack.js.org/r/webpack/?option=output/filename which is more future proof in case we will be using /webpack/ path on this site in future.

const searchParams = new URLSearchParams(location.search);
const option = searchParams.get('option');
const options = option.split('/').filter(Boolean);
return `/configuration/${options[0]}/#${options.join('').toLowerCase()}`;
}
return false;
}
5 changes: 5 additions & 0 deletions src/content/webpack-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Webpack Options
---

hello webpack.