Rails 资产管道 + git 子模块

发布于 2025-01-08 03:42:46 字数 590 浏览 3 评论 0原文

我正在尝试将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤蝉 2025-01-15 03:42:46

这取决于您如何尝试使用这些文件。我用 Skeleton 作为子模块制作了一个简单的测试应用程序,它可以工作。您可以在此处查看它。

如果不想在 application.css 中需要骨架 css 并将其用作单独的预编译文件,您需要告诉 Rails 预编译该文件。在您的 application.rb 中:

config.assets.precompile << 'skeleton.css'

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:

config.assets.precompile << 'skeleton.css'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文