简体   繁体   中英

RAILS rails assets:precompile fails

I have RAILS 6.0.3 running, so I use the 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:

Compilation failed: 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. 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

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. With RAILS 6 there are a lot of configuration files now switched to javascript style. So Javascript moves to a more important position.

I want to share one really good page that brings more light in more dark webpacker knowledge: Page from Ross Kaffenberger

This page was useful: How to debug webpack on Rails

I found that ./bin/webpack --debug was compiling the javascript code. And then doing rails assets:precompile or a rails webpacker:compile works without failure.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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