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

Use webpacker for bundling and transpiling javascript #484

Merged
merged 15 commits into from
Jun 14, 2018
Merged
Prev Previous commit
Next Next commit
Add javascript dependencies with yarn
Remove jquery-rails gem because it's now managed with yarn
stardust66 committed Jun 12, 2018
commit 673f03b71fe26994c81ea92d826a01e10279d82b
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ gem 'bootstrap-sass'
gem 'haml'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.5'
gem 'geocoder', '~> 1.2.1'
1 change: 0 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -388,7 +388,6 @@ DEPENDENCIES
http_accept_language
i18n-debug
jbuilder (~> 2.5)
jquery-rails
kaminari (~> 0.17.0)
mail_form (>= 1.7.0)
pg
7 changes: 7 additions & 0 deletions config/webpack/environment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
const { environment } = require('@rails/webpacker')
const erb = require('./loaders/erb')
const webpack = require("webpack")

environment.plugins.append('Provide', new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
Popper: ['popper.js', 'default'],
}))

environment.loaders.append('erb', erb)
module.exports = environment
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"dependencies": {
"@rails/webpacker": "3.5",
"rails-erb-loader": "^5.4.2"
"rails-erb-loader": "^5.4.2",
"bootstrap": "^4.1.1",
"jquery": "^3.3.1",
"jquery-ujs": "^1.2.2",
"popper.js": "^1.14.3"
},
"devDependencies": {
"webpack-dev-server": "2.11.2"
18 changes: 18 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -882,6 +882,10 @@ [email protected]:
dependencies:
hoek "2.x.x"

bootstrap@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.1.1.tgz#3aec85000fa619085da8d2e4983dfd67cf2114cb"

brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
@@ -3001,6 +3005,16 @@ isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"

jquery-ujs@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/jquery-ujs/-/jquery-ujs-1.2.2.tgz#6a8ef1020e6b6dda385b90a4bddc128c21c56397"
dependencies:
jquery ">=1.8.0"

jquery@>=1.8.0, jquery@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"

js-base64@^2.1.8, js-base64@^2.1.9:
version "2.4.5"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.5.tgz#e293cd3c7c82f070d700fc7a1ca0a2e69f101f92"
@@ -3981,6 +3995,10 @@ pleeease-filters@^4.0.0:
onecolor "^3.0.4"
postcss "^6.0.1"

popper.js@^1.14.3:
version "1.14.3"
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.14.3.tgz#1438f98d046acf7b4d78cd502bf418ac64d4f095"

portfinder@^1.0.9:
version "1.0.13"
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.13.tgz#bb32ecd87c27104ae6ee44b5a3ccbf0ebb1aede9"