ruby-on-rails - Webpacker 抛出 application.css not found in manifest.json in *Rails 6* application
问题描述
目前我们的应用程序使用 Rails 6。它在生产中运行良好,但在开发模式下会引发一些错误。请帮助我。
这就是我的 application.js 和 application.css 的样子
包/application.js
require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
require("jquery")
import '../stylesheets/application'
import './bootstrap_custom.js'
import './side_menu.js.erb'
//import './sweetalert.js'
import './business_hours.js'
import './admin.js'
import './services.js'
import './user_service.js'
包/样式表/application.scss
@import './bootstrap_custom.scss';
$fa-font-path: '~@fortawesome/fontawesome-free/webfonts';
@import '~@fortawesome/fontawesome-free/scss/fontawesome';
@import '~@fortawesome/fontawesome-free/scss/solid';
@import './admin_dashboard.scss';
@import './side_menu.css';
@import './fonts.scss';
@import './login.css';
解决方案
After a long struggle I found a solution for this. Thanks @ahmed kamal.
Multiple packs with the same name but a different extension.
i.e: application.scss and application.js only the last one will make it to the webpack entry path configuration.
Solution:
1. Rename stylesheets/application.scss into stylesheets/style.scss
2. Import style.scss in application.js like this import '../stylesheets/style'
3. config/webpacker.yml make below changes
compile: true
cache_manifest: true
extract_css: true
If this solution not working for you, try th
rake assets:precompile
Thats all its started working fine for me
推荐阅读
- python - df.sort_values 不是排序表(python/pandas)
- java - 如何调试 jbehave 故事运行的 selenium 远程 Web 驱动程序?
- c++ - 迷宫求解程序的回溯逻辑错误
- javascript - ng-circle-progress 组件仅在属性 renderOnClick 属性设置为 true 时有效
- postgresql - 检索具有给定列表中不存在的列值的行
- c# - 使游戏对象加载和活动加载屏幕同时运行
- java - 如果我更改了 XML 清单中的启动器活动,则应用程序重新启动
- java - java.lang.ClassNotFoundException:没有找到类“android.view.View$OnUnhandledKeyEventListener
- django - Wagtail - 非页面对象的修订
- docker - 构建我的 docker 文件时,我收到一个返回的非零代码:8