Skip to content

Instantly share code, notes, and snippets.

@risen
Created May 2, 2019 16:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save risen/076916a3cea81c83cb0752760772d8bf to your computer and use it in GitHub Desktop.
Save risen/076916a3cea81c83cb0752760772d8bf to your computer and use it in GitHub Desktop.
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 82e6f0f..3ea44f8 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -1,16 +1,8 @@
-// This is a manifest file that'll be compiled into application.js, which will include all the files
-// listed below.
-//
-// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
-// vendor/assets/javascripts directory can be referenced here using a relative path.
-//
-// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-// compiled file. JavaScript code in this file should be added after the last require_* statement.
-//
-// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
-// about supported directives.
-//
-//= require rails-ujs
-//= require activestorage
-//= require turbolinks
-//= require_tree .
+import Rails from 'rails-ujs'
+import * as ActiveStorage from 'activestorage'
+import Turbolinks from 'turbolinks'
+import 'bootstrap'
+
+Rails.start()
+ActiveStorage.start()
+Turbolinks.start()
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
deleted file mode 100644
index d05ea0f..0000000
--- a/app/assets/stylesheets/application.css
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * This is a manifest file that'll be compiled into application.css, which will include all the files
- * listed below.
- *
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
- * vendor/assets/stylesheets directory can be referenced here using a relative path.
- *
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
- * files in this directory. Styles in this file should be added after the last require_* statement.
- * It is generally better to create a new file per style scope.
- *
- *= require_tree .
- *= require_self
- */
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
new file mode 100644
index 0000000..5de3350
--- /dev/null
+++ b/app/assets/stylesheets/application.scss
@@ -0,0 +1 @@
+@import '~bootstrap/scss/bootstrap';
diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js
index 7c3021d..d4f46eb 100644
--- a/app/javascript/packs/application.js
+++ b/app/javascript/packs/application.js
@@ -16,3 +16,6 @@
// const imagePath = (name) => images(name, true)
console.log('Hello World from Webpacker')
+
+import 'javascripts/application';
+import 'stylesheets/application';
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 7b95352..08373b3 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -5,8 +5,8 @@
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
- <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
+ <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
+ <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
<body>
diff --git a/config/webpacker.yml b/config/webpacker.yml
index 6fd5312..1d1a02e 100644
--- a/config/webpacker.yml
+++ b/config/webpacker.yml
@@ -11,7 +11,7 @@ default: &default
# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
- resolved_paths: []
+ resolved_paths: [ 'app/assets' ]
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
diff --git a/package.json b/package.json
index ff4efa1..554497e 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,13 @@
"name": "dark_and_blond",
"private": true,
"dependencies": {
- "@rails/webpacker": "^4.0.2"
+ "@rails/webpacker": "^4.0.2",
+ "activestorage": "^5.2.2",
+ "bootstrap": "^4.3.1",
+ "jquery": "^3.3.1",
+ "popper.js": "^1.14.7",
+ "rails-ujs": "^5.2.2",
+ "turbolinks": "^5.2.0"
},
"devDependencies": {
"webpack-dev-server": "^3.2.1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment