Created
December 8, 2017 13:22
-
-
Save rebelweb/c2c8e08ab57daecbdc8286b9e18ed2fe to your computer and use it in GitHub Desktop.
Webpacker / Bootstrap Config
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 characters
| <%# /app/views/layouts/application.html.erb %> | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>RyancondronPhotography</title> | |
| <%= csrf_meta_tags %> | |
| <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> | |
| <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> | |
| </head> | |
| <body> | |
| <%= yield %> | |
| </body> | |
| </html> |
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 characters
| // app/javscripts/packs/application.js | |
| console.log('Hello World from Webpacker') | |
| // import javascript dependencies | |
| import 'jquery' | |
| import 'popper.js' | |
| import 'bootstrap' | |
| // import stylesheets | |
| import '../application' |
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 characters
| // app/javascripts/application.scss | |
| // Bootstrap | |
| @import 'node_modules/bootstrap/scss/bootstrap'; |
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 characters
| // config/webpack/development.js | |
| const environment = require('./environment') | |
| module.exports = environment |
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 characters
| // config/webpack/environment.js | |
| const { environment } = require('@rails/webpacker') | |
| const webpack = require('webpack') | |
| environment.plugins.set('Provide', new webpack.ProvidePlugin({ | |
| $: 'jquery', | |
| jQuery: 'jquery', | |
| jquery: 'jquery', | |
| Popper: 'popper.js' | |
| }) | |
| ) | |
| const config = environment.toWebpackConfig() | |
| config.resolve.alias = { | |
| jquery: 'jquery/src/jquery', | |
| 'popper.js': 'popper.js/dist/umd/popper.js' | |
| } | |
| module.exports = config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment