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

Overhaul readme and add guides [ci skip] #372

Merged
merged 8 commits into from
May 24, 2017
Merged

Overhaul readme and add guides [ci skip] #372

merged 8 commits into from
May 24, 2017

Conversation

gauravtiwari
Copy link
Member

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

@Davidzhu001
Copy link
Contributor

@gauravtiwari You mean develop docs?
I am in, but my language might not be good. lol

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
Copy link
Contributor

@ytbryan ytbryan May 12, 2017

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.

Copy link
Contributor

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?

Copy link
Member Author

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)
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, will nix this 👍

Copy link
Contributor

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.

Copy link
Member Author

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
Copy link
Contributor

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

Copy link
Member Author

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 👍

Copy link

@zacharyw zacharyw May 21, 2017

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
Copy link
Contributor

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.
Copy link
Contributor

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)
Copy link
Contributor

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»

Copy link
Contributor

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.

Copy link
Contributor

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).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, lets do that 👍

Copy link
Contributor

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.

Copy link
Contributor

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.

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?

Copy link
Member Author

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
Copy link
Contributor

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
Copy link
Contributor

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`
Copy link
Contributor

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

Copy link
Member Author

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

@gauravtiwari
Copy link
Member Author

Feel free to leave any comments 👍 Gonna do a few more updates later this evening

@gauravtiwari gauravtiwari changed the title [WIP] Overhaul readme and add guides Overhaul readme and add guides [ci skip] May 23, 2017
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`
Copy link
Contributor

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
Copy link
Contributor

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!
Copy link
Contributor

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

@dhh
Copy link
Member

dhh commented May 24, 2017

What do these changes have to do with the docs? Seems like a bunch of stuff for babelrc?

@gauravtiwari
Copy link
Member Author

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.

@gauravtiwari
Copy link
Member Author

Could have done it in separate PR but were very small so consolidated in this one :)

@dhh
Copy link
Member

dhh commented May 24, 2017 via email

@gauravtiwari
Copy link
Member Author

gauravtiwari commented May 24, 2017

Updated the PR and made a new one for other changes - #409 (README contains changes for #409, need to merge them together)

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
@dhh dhh merged commit 90749dd into rails:master May 24, 2017
@gauravtiwari gauravtiwari deleted the overhaul-readme branch May 24, 2017 14:12
If you are using vim or emacs and want to ignore certain files you can add `ignore-loader`:

```
yard add ignore-loader
Copy link

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants