-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Overhaul readme and add guides [ci skip] #372
Conversation
@gauravtiwari You mean develop docs? |
README.md
Outdated
# For Rails 5.1+ | ||
rails new webpacker-example-app --webpack=react | ||
rails new webpacker-example-app --webpack=angular | ||
rails new webpacker-example-app --webpack=vue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./bin/rails new webpacker-app --webpack=elm?
Edited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use bin/rails
everywhere for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
README.md
Outdated
- [Ready for Vue](#ready-for-vue) | ||
- [Ready for Elm](#ready-for-elm) | ||
- [Troubleshooting](#troubleshooting) | ||
- [Wishlist](#wishlist) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WIshlist? Do you think this should be replaced with "contribution" or simply be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, will nix this 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reply @gauravtiwari My reasoning is that we should encourage folks to contribute.
i think they can always send a pull request for any "wishlist" feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, sounds like good idea 👍
README.md
Outdated
We recommend using `webpack-dev-server` during development for better experience, however if you don't want that you can run `webpack` binstub in watch mode. | ||
|
||
```bash | ||
./bin/webpack --watch --progress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work without re-configuring the default dev server config? I don't know how --watch works enough to say, but I think by default, Rails expects assets to be available via :8080
in development
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yepp, but you can disable it from development.server.yml
. Probably need to rephrase this a bit 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth noting in the README here that in order for your JS to load in feature specs without having webpack-dev-server
running you need to manually set the Capybara puma port to something and then set that same port in the test
block of development.server.yml
README.md
Outdated
|
||
### Babel | ||
|
||
Webpacker ships with [babel](https://babeljs.io/) - a JavaScript compiler so, you can use next generation JavaScript, today. Webpacker installer by default sets up a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor language nit:
Webpacker installer by default sets up a standard .babelrc
might be better as
The Webpacker generator sets up a default standard .babelrc
README.md
Outdated
|
||
### Hot module replacement | ||
|
||
Webpacker out-of-the-box doesn't shipt with HMR just yet. You will need to install additional plugins for Webpack if you want HMR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: s/shipt/ship
README.md
Outdated
- [Getting asset path](#getting-asset-path) | ||
- [Deployment](#deployment) | ||
- [Linking to sprockets assets](#linking-to-sprockets-assets) | ||
- [Ready for React](#ready-for-react) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This TOC is awesome and helps navigate this big file! 💯
Now that ELM is in here, should we add a second level? e.g.
## Ready for JavaScript Frameworks
«some intro»
### Angular w/ TypeScript
«existing content»
### Elm
«existing content»
### React
«existing content»
### Vue
«existing content»
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I second the above. It would be nice to add the top-level JavaScript Frameworks section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 BTW, if you want the Ruby equivalent of DocToc, you might want to check out Tocer. I use it for all my projects (both for private and public repos). The nice thing about Tocer is that you can add it as a gem dependency to the project and wire it up a check for README changes prior to deploy (or even part of the build process).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, lets do that 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gauravtiwari ok, I opened a PR for this since I figured it would be easier to review that way. It will create a slight conflict with this PR but the diff shouldn't be too bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gauravtiwari I apologize for the noise but I'm afraid the Tocer gem won't work on this project due to Webpacker needing to support older versions of Ruby. I had forgotten about that. You'll have to stick with DocToc, I guess.
README.md
Outdated
``` | ||
|
||
*Note:* Behind the scenes, webpacker will use same `entry` directory name inside `output` | ||
directory to emit bundles. For ex, `public/packs` | ||
Please note that you always want to change the source directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is a typo or you mean something I do not quite get. If I always want to change the source directory then what purpose does a default serve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets rephrase this then 👍
README.md
Outdated
already set in the configuration file. | ||
|
||
```bash | ||
./bin/webpack-dev-server --host 0.0.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize we allowed/encouraged passing options like --host
and probably broke it in 2a94cdf because it constructs ASSET_HOST
using development.server.yml
exclusively. bin/webpack-dev-server
will need updating.
README.md
Outdated
output: public | ||
config: config/webpack | ||
node_modules: node_modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This paths.yml
example should be updated to reflect the changes in #397
README.md
Outdated
however `entry` will always be a single directory like `packs` or `modules`. | ||
|
||
Behind the scenes, webpacker will use same `entry` directory name inside `output` | ||
directory to emit bundles. For ex, `public/packs` or `public/modules` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto re: changes in #397
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yepp fixed it 👍 Will make a PR soon
Feel free to leave any comments 👍 Gonna do a few more updates later this evening |
More updates to readme Update TOC Separate out integrations Regenerate TOC Cleanup Generate TOC Add typescript and passing down data from view doc Move to how-tos Minor updates Fix typos Nitpicking Udpate TOC Fix typos Fix extension
README.md
Outdated
|
||
## Binstubs | ||
|
||
Webpacker ships with two binstubs: `./bin/webpack` and `./bin/webpack-dev-server`. | ||
They're thin wrappers around the standard webpack.js executable, just to ensure that the right configuration file is loaded depending on your environment. | ||
They're thin wrappers around the standard `webpack.js` and `webpack-dev-server.js` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're not really wrappers around .js
files. They wrap each npm module's bin/
script, e.g. node_modules/.bin/webpack
.
README.md
Outdated
``` | ||
|
||
|
||
### Webpack watcher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't feel right to call this "Webpack watcher". I'd just document the existence of bin/webpack
and that you can pass options like --watch
.
README.md
Outdated
### CDN | ||
|
||
Webpacker out-of-the-box provides CDN support using `ASSET_HOST` environment variable | ||
set within your Rails app. You don't need to do anything extra, it just works. Voila! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to set or know about ASSET_HOST
. It's just what our bin/
scripts use internally. Webpacker uses your app's config.action_controller.asset_host
. http://guides.rubyonrails.org/asset_pipeline.html#cdns or http://guides.rubyonrails.org/configuring.html#rails-general-configuration
What do these changes have to do with the docs? Seems like a bunch of stuff for babelrc? |
Basically, a few small things we missed earlier so added it for more polished release. Babel changes are to support some latest ES6 features out of the box. |
Could have done it in separate PR but were very small so consolidated in this one :) |
Yeah, in general, I think it's better if we keep the PRs single purpose.
They serve better as history and documentation. Let's split them.
Also, I don't actually see any new readme or guide material in this PR?
Just a bunch of spacing changes?
…On Wed, May 24, 2017 at 1:25 PM, Gaurav Tiwari ***@***.***> wrote:
Could have done it in separate PR but were very small so consolidated in
this one :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#372 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAKtchv6ldbFwTD-trUm3yfWf3fEKScks5r9BPHgaJpZM4NZgfn>
.
|
More updates Add css next Minor typos Fix typos Fix typos Remove babelrc and postcss exist check Update changelog Fix typo Ignore vendor Remove declaration Fix typo Fix typo Add more things to doc Remove other changes Remove other changes Remove other changes Nitpicking Fix loader
If you are using vim or emacs and want to ignore certain files you can add `ignore-loader`: | ||
|
||
``` | ||
yard add ignore-loader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean yarn :)
Started working on overhauling README plus adding some guides related to advanced usage. Would be nice if everyone can chip in topics they would like to see in the README.
//cc
@Davidzhu001 @bkuhlmann @ytbryan @p0wl @renchap @RavenXce @davetron5000 @kuroda