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

Moving toward a first pass #1

Merged
merged 2 commits into from
May 25, 2020
Merged

Moving toward a first pass #1

merged 2 commits into from
May 25, 2020

Conversation

noelrappin
Copy link
Owner

@noelrappin noelrappin commented May 15, 2020

Starting for a first draft, thanks to @codergeek121 for some text that I added here. I'll likely keep adding to this PR until I either finish a draft or start getting other PRs

@noelrappin noelrappin self-assigned this May 15, 2020
Copy link

@tvanderpol tvanderpol left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this! I've learned a lot over the last few days on the WTForum other places, I'll try to help with this where I can.

webpacker_guide.md Show resolved Hide resolved
Webpacker is installed by default in Rails 6.0 and up. In an older version, you can install it when a new project is created by adding `--webpack` to a `rails new` command. In an existing project, webpacker can be added by installing `bundle exec rails webpacker:install`. This installation command creates local files:

* The Webpacker configuration at `config/webpacker.html`
* Configuration files for Babel, PostCSS, and Browserslist

Choose a reason for hiding this comment

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

babel.config.js and postcss.config.js in app root. I don't know where the browsers list file ends up. Is it worth a short sentence each describing what these files are for, or is that out of scope?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably explain each of the config files with a single sentence and link to further documentation.
You can find the Browserlist Configuration file in the app root .browserslistrc, but you need to display your hidden files, since its filename is prefixed with a dot.

Copy link
Owner Author

Choose a reason for hiding this comment

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

How much more description do we need other than "configuration file"?

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case I would just link to the technology docs, I can open a PR for that.
I think it's a general question for this guide.
Should this guide make it possible to understand the ecosystem that comes with Webpack/Webpacker or should it give a overview about Webpacker on condition that someone is familiar with Webpack and everything JS related?
What do you think?

Copy link

Choose a reason for hiding this comment

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

In this case I would just link to the technology docs, I can open a PR for that.
I think it's a general question for this guide.
Should this guide make it possible to understand the ecosystem that comes with Webpack/Webpacker or should it give a overview about Webpacker on condition that someone is familiar with Webpack and everything JS related?
What do you think?

I think this guide needs to enable somebody who's not familiar with Webpack to get things up and running. The nitty gritty details of customizing Webpack could go into the Webpacker gem documentation.

Sprockets, which was designed to be used with Rails, is somewhat simpler to integrate. In particular, code can be added to Sprockets via a Ruby gem. However, webpack is better at integrating with more current JavaScript tools and NPM packages, and allows for a wider range of integration.

You should choose webpacker over Sprockets on a new project, if you want to use NPM packages, and if you want access to the most current JavaScript features and tools. You should choose Sprockets over Webpacker for legacy applications where migration might be costly, if you want to integrate using Gems, or if you have a very small amount of code to package.

Copy link

Choose a reason for hiding this comment

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

Is this a Webpacker specific guide, or an overall Rails JS guide?

If the latter, would suggest a note that Webpack is the recommended JS option for Rails 6+, but also provide guidance on how to revert to Sprockets for JS, eg.
https://stackoverflow.com/questions/55213868/rails-6-how-to-disable-webpack-and-use-sprockets-instead

Copy link
Owner Author

Choose a reason for hiding this comment

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

Webpacker for now, trying to keep this focused in the hope of getting it done


Webpacker is installed by default in Rails 6.0 and up. In an older version, you can install it when a new project is created by adding `--webpack` to a `rails new` command. In an existing project, webpacker can be added by installing `bundle exec rails webpacker:install`. This installation command creates local files:

* The Webpacker configuration at `config/webpacker.html`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* The Webpacker configuration at `config/webpacker.html`
* The Webpacker configuration at `config/webpacker.yml`

@noelrappin noelrappin merged commit b8e3443 into master May 25, 2020
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.

4 participants