rails6で開発しています。
開発環境ではBootstrapが反映されているのですが、本番環境で効いていません。
原因が分からず手詰まり状態です。ご助言をお願いします。
##環境
ruby 2.7.1p83
Rails 6.0.3.4
package.json
の記載内容
{ "name": "アプリ名", "private": true, "dependencies": { "@fortawesome/fontawesome-free": "^5.15.1", "@rails/actioncable": "^6.0.0", "@rails/activestorage": "^6.0.0", "@rails/ujs": "^6.0.0", "@rails/webpacker": "4.3.0", "admin-lte": "^3.0.5", "bootstrap": "^4.5.3", "jquery": "^3.5.1", "popper.js": "^1.16.1", "turbolinks": "^5.2.0" }, "version": "0.1.0", "devDependencies": { "webpack-dev-server": "^3.11.0" } }
app/assets/stylesheets/application.scss
の記載内容
/* * 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 jquery.tagit *= require tagit.ui-zendesk *= require_self */
app/assets/javascript/stylesheets/application.scss
の記載内容
@import '~bootstrap/scss/bootstrap';
app/javascript/packs/application.js
require("@rails/ujs").start() require("turbolinks").start() require("@rails/activestorage").start() require("channels") require("jquery") import "bootstrap" import '../stylesheets/application'; import '@fortawesome/fontawesome-free/js/all';
<head>
記載内容
<%= csrf_meta_tags %> <%= csp_meta_tag %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload', 'data-turbolinks-eval': false %> <%= favicon_link_tag('favicon.png') %>
原因が見当もつかず困っております。どこか気になる点でもありましたらご指摘ください。よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。