-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Dev - Display Index Pages Correctly #1085
Comments
@bebraw is there anyway to access the index page's data? I'm not even sure we're parsing out the anchors for index pages as of right now... |
@skipjack The current logic might skip indices, yeah. Most likely |
No support yet. |
Ah ok, would you like me to create a ticket over at antwar for this as well? |
Sure, open tickets. Easier to keep track of things. |
I'm not familiar with the antwar/build process of this so, while in no way a long term solution, how do you all feel about this interim hotfix? Conceptswebpack is a module bundler for modern JavaScript applications. When webpack processes your application, it recursively builds a dependency graph that includes every module your application needs, then packages all of those modules into a small number of bundles - often only one - to be loaded by the browser. It is incredibly configurable, but to get started you only need to understand Four Core Concepts: entry, output, loaders, and plugins. This document is intended to give a high-level overview of these concepts, while providing links to detailed concept specific use-cases. Entrywebpack creates a graph of all of your application's dependencies. Expand Quick ViewIn webpack we define entry points using the The simplest example is seen below: webpack.config.js module.exports = {
entry: './path/to/my/entry/file.js'
}; There are multiple ways to declare your Learn more! OutputOnce you've bundled all of your assets together, you still need to tell webpack where to bundle your application. The webpack Expand Quick Viewwebpack.config.js const path = require('path');
module.exports = {
entry: './path/to/my/entry/file.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'my-first-webpack.bundle.js'
}
}; In the example above, we use the T> You may see the term emitted or emit used throughout our documentation and plugin API. This is a fancy term for "produced or discharged". The Learn more! LoadersThe goal is to have all of the assets in your project to be webpack's concern and not the browser's. (This doesn't mean that they all have to be bundled together). webpack treats every file (.css, .html, .scss, .jpg, etc.) as a module. However, webpack only understands JavaScript. Expand Quick ViewLoaders in webpack transform these files into modules as they are added to your dependency graph. At a high level, they have two purposes in your webpack config.
webpack.config.js const path = require('path');
const config = {
entry: './path/to/my/entry/file.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'my-first-webpack.bundle.js'
},
module: {
rules: [
{test: /\.(js|jsx)$/, use: 'babel-loader'}
]
}
};
module.exports = config; The configuration above has defined a
W> It is important to remember when defining rules in your webpack config, you are defining them under There are more specific properties to define on loaders that we haven't yet covered. PluginsSince Loaders only execute transforms on a per-file basis, Expand Quick ViewIn order to use a plugin, you just need to webpack.config.js const HtmlWebpackPlugin = require('html-webpack-plugin'); //installed via npm
const webpack = require('webpack'); //to access built-in plugins
const path = require('path');
const config = {
entry: './path/to/my/entry/file.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'my-first-webpack.bundle.js'
},
module: {
rules: [
{test: /\.(js|jsx)$/, use: 'babel-loader'}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin(),
new HtmlWebpackPlugin({template: './src/index.html'})
]
};
module.exports = config; There are many plugins that webpack provides out of the box! Check out our list of plugins for more information. Using plugins in your webpack config is straight-forward, however there are many use-cases that are worth discussing further. Learn more! |
@rouzbeh84 I do kind of like this idea for index pages however it doesn't really fix the issue of "Introduction" links not displaying their anchors in the sidebar. Although I guess if we did it this way then the anchor links would just be repetitious so maybe this is an alternative. It would change things a bit as all index pages would basically just contain a lead-in and then the rest of it would be populated dynamically based on the other pages in the section. @simon04 what do you think? #980 will be merged soon, like hopefully tomorrow if we can resolve the last few things, so it might not be long until we can get the fix we discussed initially in. |
@skipjack While I agree that it doesn't solve this issue I don't think it's bad that index pages would essentially become brief intros w/hotlinks to the section as a whole I guess? I do see that some Intro pages are wildly diff (i.e. Would the 'Introduction' page have to just nest the sections itself as an alternative to replicate how other sections in the sidebar are handled/displayed? I know I've mentioned this before and one day I'll learn more about it but can 'Introduction' aggregate all header level links into its own dropdown? |
Yeah "one size fits all" would probably be tough but maybe keeping an
We do have access to all the page data from anywhere we want so you wouldn't have to hardcode this, if that's what you're asking. I don't really think a dropdown is the way to go (although maybe I'm not understanding how it would be used) but I think what you showed above, without the "Expand Quick View" sections could work. Simply showing the title of each article, first paragraph, and a link to jump into it. |
Either a port or #980 should solve this -- let's track in #1380 though I did link back here so we can reference the screenshots and @rouzbeh84's idea. We can always re-open if it would be helpful once we start a fix. |
The main purpose of this PR is just to bring our dependencies, especially webpack and antwar up to date. In the process of doing this, we also resolved a variety of bugs and other issues. There is still much work to be done but this is definitely a step in the right direction and should make further changes easier. Here are some other notable changes: * refactor(components): clean up formatting and usage * fix(components): fix `PropTypes` warnings * refactor(config): remove unused vote routes * refactor(config): utilize `disable` option in the extract plugin to simplify config * fix(build-process): fix missing `<title>` tags * fix(components): simplify index page management in sidebar (#1085) * docs: minor improvements to index pages * fix(tests): ignore npm-install-weback-plugin Ignore the "sucks" mention in the npm-install-webpack-plugin file for now. It isn't used in a derogatory way so I'm not sure we should change it but I'm also not sure we should `allow` "sucks" globally.
In the menu, the page https://webpack.js.org/concepts/ is shown as "Introduction" w/o listing its subsection such as https://webpack.js.org/concepts/#entry or https://webpack.js.org/concepts/#output.
Proposed changes:
Screenshot:
The text was updated successfully, but these errors were encountered: