Last active
July 20, 2022 20:29
-
-
Save yalab/cad361056bae02a5f45d1ace7f1d86ef to your computer and use it in GitHub Desktop.
Revisions
-
yalab revised this gist
Aug 31, 2017 . 1 changed file with 15 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,21 +6,21 @@ $ yarn add [email protected] jquery popper.js ``` ```diff diff --git a/config/webpack/environment.js b/config/webpack/environment.js index d16d9af..86bf1a7 100644 --- a/config/webpack/environment.js +++ b/config/webpack/environment.js @@ -1,3 +1,10 @@ const { environment } = require('@rails/webpacker') +const webpack = require('webpack') +environment.plugins.set('Provide', new webpack.ProvidePlugin({ + $: 'jquery', + jQuery: 'jquery', + Popper: ['popper.js', 'default'] +})) + module.exports = environment ``` ```scss -
yalab revised this gist
Aug 30, 2017 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ ```bash $ echo 'gem "webpacker"' >> Gemfile $ bundle install $ rails webpacker:install $ yarn add [email protected] jquery popper.js ``` ```diff diff --git a/config/webpack/shared.js b/config/webpack/shared.js index d901cc6..fe9a34d 100644 --- a/config/webpack/shared.js @@ -23,17 +23,17 @@ index d901cc6..fe9a34d 100644 ], ``` ```scss // app/javascript/packs/bootstrap.scss @import '~bootstrap/dist/css/bootstrap'; ``` ```js // app/javascript/packs/applicatoin.js import 'bootstrap/dist/js/bootstrap'; ``` ```erb --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -6,6 +6,8 @@ -
yalab renamed this gist
Aug 30, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
yalab created this gist
Aug 30, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ ``` $ echo 'gem "webpacker"' >> Gemfile $ bundle install $ rails webpacker:install $ yarn add [email protected] jquery popper.js ``` ``` diff --git a/config/webpack/shared.js b/config/webpack/shared.js index d901cc6..fe9a34d 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -41,6 +41,11 @@ module.exports = { new ManifestPlugin({ publicPath: output.publicPath, writeToFileEmit: true + }), + new webpack.ProvidePlugin({ + $: "jquery", + jQuery: "jquery", + Popper: ['popper.js', 'default'] }) ], ``` ``` // app/javascript/packs/bootstrap.scss @import '~bootstrap/dist/css/bootstrap'; ``` ``` // app/javascript/packs/applicatoin.js import 'bootstrap/dist/js/bootstrap'; ``` ``` --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -6,6 +6,8 @@ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> + <%= javascript_pack_tag 'application' %> + <%= stylesheet_pack_tag 'bootstrap' %> </head> <body> ```