Skip to content

Introduce Webpacker and component approach #520

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": "> 1%",
"uglify": true
},
"useBuiltIns": true
}]
],

"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
["transform-class-properties", { "spec": true }]
]
}
22 changes: 22 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"parser": "babel-eslint",
"extends": ["airbnb", "plugin:prettier/recommended", "prettier/react"],
"env": {
"browser": true,
"jquery": true
},
"rules": {
"react/require-default-props": 0
},
"settings": {
"import/resolver": {
"webpack": {
"config": {
"resolve": {
"modules": ["frontend", "node_modules"]
}
}
}
}
}
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ vendor/ruby
._*
.env
.pryrc
/public/packs
/public/packs-test
/node_modules
yarn-debug.log*
yarn-error.log*
.yarn-integrity
3 changes: 3 additions & 0 deletions .postcssrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins:
postcss-import: {}
postcss-cssnext: {}
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
}
140 changes: 0 additions & 140 deletions .scss-lint.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "stylelint-config-recommended-scss"
}
1 change: 1 addition & 0 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ cask "phantomjs"
brew "graphviz"
brew "node"
brew "postgresql"
brew "yarn"
16 changes: 2 additions & 14 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,13 @@ gem "pg"
gem "rails", "5.1.6.1"

# assets
gem "autoprefixer-rails"
gem "coffee-rails"
gem "foundation-icons-sass-rails"
gem "foundation-rails"
gem "premailer-rails"
gem "sass-rails", "~> 5.0.0", ">= 5.0.6"
gem "uglifier", ">= 2.7.2"

source "https://rails-assets.org" do
gem "rails-assets-jquery-ujs"
gem "rails-assets-jquery2"
end
Copy link

Choose a reason for hiding this comment

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

Does this changes means that Assets Pipeline will be removed completely and replaced with Webpacker?

Copy link
Author

Choose a reason for hiding this comment

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

Yup. Do you have concerns about it?

Copy link

Choose a reason for hiding this comment

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

Yes, I have. It could be more easy to understand if you suggest to add something new and leave all present things here and enable users to continue use technologies they know and technologies they have experience with. Assets Pipeline with all things we use everyday, like Coffee, like rails helpers etc IS compatible with Webpacker, they can be present in one project and work together. If you goal is - moving to new ES6 technology stack, why we MUST drop all previous experience? We did no have a choice? In case rails-base was regular open source project this will be good time to fork at because it will be non-useful for 50% of projects and 75% of developers. As I know almost all projects we start DO NOT require all this complex things, but now, after that change, every project will require react-developer right from start OR require BE developer to program with React / Node. More complex deployment, many new configs for ES6 transpiling, Nodejs, problem's with JQuery (that actually do the job for us, right, except religion questions)... So, really, it's more easy to fork this and drop 50% of things to get really "rails skeleton" lightweight and pre-configured for any type of projects.

Copy link
Author

Choose a reason for hiding this comment

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

It makes sense. I think we need to get together BE and FE devs and discuss this case in office.

Copy link
Contributor

Choose a reason for hiding this comment

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

@vladimirbazhanov https://evilmartians.com/chronicles/evil-front-part-1 what do you think about this?

I guess in the future projects it is better to start with modern technologies and frameworks.

Being a fresh Rails full-stack developer out in the wild is a confusing endeavor nowadays. A “classic Rails” way to handle front-end with Asset Pipeline, Sprockets, CoffeeScript, and Sass looks outdated in 2017. A lot of choices made back in the times of Rails 3.1 do not live up to modern expectations. Sticking with the “old way” means passing on everything that happened in the front-end community over the past half decade: the rise of npm as a JavaScript package manager to rule them all, the emergence of ES6 as a go-to JS syntax, the winning streak of transpilers and build tools, the ever-growing embrace of PostCSS as an alternative to CSS pre-processors. Not to mention the astounding success of front-end frameworks like React and Vue that change the very way we think about front-end code: components instead of “pages”.

gem "webpacker", "~> 3.5"

# views
gem "active_link_to"
gem "inky-rb", require: "inky"
gem "meta-tags"
gem "premailer-rails"
gem "simple_form"
gem "slim"

Expand Down Expand Up @@ -75,8 +65,6 @@ group :development, :test do
gem "dotenv-rails"
gem "factory_girl_rails"
gem "faker"
gem "jasmine", "> 2.0"
gem "jasmine-jquery-rails"
gem "pry-rails"
gem "rspec-rails", "~> 3.5"
gem "rubocop", require: false
Expand Down
Loading