Rails 资产管道 + git 子模块
我正在尝试将 Skeleton 与 Ruby on Rails 一起使用。我想要做的是将 Skeleton 目录作为 git 子模块放入供应商目录中,以便获得与此类似的内容:
...
vendor/
...
Skeleton/
...
stylesheets/
robots.txt
尝试将以下行添加到 config/application.rb 中:
config.assets.paths << Rails.root.join("vendor", "assets", "Skeleton", "stylesheets")
我 将样式表文件夹添加到资产管道的路径中,但样式表目录中的文件仍然给出路由错误...
我该如何使其工作?
PS:我希望将 Skeleton 作为 vendor/assets
中的 git 子模块
,因此不能选择分离文件。
I am trying to use Skeleton with Ruby on Rails. What I want to do is to put the Skeleton directory in the vendor directory as a git submodule in order to have something similar to this:
...
vendor/
...
Skeleton/
...
stylesheets/
robots.txt
I tried to add the following line to config/application.rb
:
config.assets.paths << Rails.root.join("vendor", "assets", "Skeleton", "stylesheets")
It added the stylesheet folder to the assets pipeline's paths but the files in the stylesheet directory still give a routing error...
How can I make this work please?
PS: I want to have Skeleton as a git submodule
in vendor/assets
so separating the files is not an option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您如何尝试使用这些文件。我用 Skeleton 作为子模块制作了一个简单的测试应用程序,它可以工作。您可以在此处查看它。
如果不想在 application.css 中需要骨架 css 并将其用作单独的预编译文件,您需要告诉 Rails 预编译该文件。在您的 application.rb 中:
It's depends how you try to use this files. I have made a simple test app with Skeleton as submodule and it works. You can see it here.
If don't want to require skeleton css in application.css and use it as separated precompiled file you neeed tell rails to precompile that file. In your application.rb: