简体   繁体   English

RAILS rails 资产:预编译失败

[英]RAILS rails assets:precompile fails

I have RAILS 6.0.3 running, so I use the webpacker.我有 RAILS 6.0.3 运行,所以我使用 webpacker。

When I try to compile the assets with rails assets:precompile in RAILS deveopment mode it runs very well, but when I try to run it in RAILS production mode I got the error message:当我尝试在 RAILS 开发模式下使用 rails assets:precompile 编译资产时,它运行得很好,但是当我尝试在 RAILS 生产模式下运行它时,我收到错误消息:

Compilation failed: CssSyntaxError: /data/rails-base-dir/jquery-ui.css:1:1: Unknown word编译失败:CssSyntaxError: /data/rails-base-dir/jquery-ui.css:1:1: Unknown word

But the file /data/rails-base-dir/jquery-ui.css does not exist.但是文件 /data/rails-base-dir/jquery-ui.css 不存在。 So there is something wrong with paths/locations...所以路径/位置有问题......

I have no approach how to fix it.我不知道如何修复它。

For installation jquery-ui: I have followed this guide: gist.github.com/.../#jquery-jquery-ui对于安装 jquery-ui:我遵循了本指南: gist.github.com/.../#jquery-jquery-ui

After somes days to try and work - found a solution.经过几天的尝试和工作 - 找到了解决方案。 There is one gap that I have in my knowledge.我的知识有一个差距。 How the webpacker works and how to configure. webpacker 如何工作以及如何配置。 With RAILS 6 there are a lot of configuration files now switched to javascript style.在 RAILS 6 中,有很多配置文件现在已切换为 javascript 样式。 So Javascript moves to a more important position.所以 Javascript 移动到更重要的 position。

I want to share one really good page that brings more light in more dark webpacker knowledge: Page from Ross Kaffenberger我想分享一个非常好的页面,它在更黑暗的 webpacker 知识中带来更多的光明: Ross Kaffenberger 的页面

This page was useful: How to debug webpack on Rails此页面很有用: How to debug webpack on Rails

I found that ./bin/webpack --debug was compiling the javascript code.我发现./bin/webpack --debug正在编译 javascript 代码。 And then doing rails assets:precompile or a rails webpacker:compile works without failure.然后执行rails assets:precompilerails webpacker:compile工作没有失败。

But I did not found out the reason of the initial failure:但是我没有找到最初失败的原因:

Compilation failed: CssSyntaxError: /data/rails-base-dir/jquery-ui.css:1:1: Unknown word编译失败:CssSyntaxError: /data/rails-base-dir/jquery-ui.css:1:1: Unknown word

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM