Skip to content

[rails] 在 Rails 更新了 asset stylesheet 或 javascript 但卻沒有更新

Published: at 03:08 AM (1 min read)

前陣子遇到在 Rails 6 的專案中更新了既有 asset stylesheet 或 javascript 的內容,例如

<%= stylesheet_link_tag    "custom" %>
<%= javascript_include_tag "custom" %>

但在載入 custom.css 或 custom.js 時,發現都會沒有更新到最新的內容。

後來發現可以手動清除 asset pipeline 的 cache 解決 🫠

rm -rf tmp/cache/assets