资产管道甚至不会尝试编译SASS(Asset pipeline won't even try to compile SASS)

编程入门 行业动态 更新时间:2024-10-17 07:38:16
资产管道甚至不会尝试编译SASS(Asset pipeline won't even try to compile SASS)

我的设置是相当简单的默认导轨3.2.1设置。 我所有的.css.sass文件都在/app/assets/stylesheets/ 。 我有sass-rails '~> 3.2.3'宝石:assets组。

没有application.css,只有main.css.sass (用于主布局)。

当我发出:

RAILS_ENV=production bundle exec rake assets:precompile

它编译我的咖啡脚本和JavaScript。 日志中没有错误消息。 它就像它甚至不尝试编译sass文件。

main.css.sass文件头看起来像这样:

//=depend_on "_globals.css.sass" @import globals

_glocals.css.sass存在于同一个目录中。

My setup is fairly simple default rails 3.2.1 setup. All my .css.sass files are in /app/assets/stylesheets/. I have the sass-rails '~> 3.2.3' gem in :assets group.

There's no application.css, just main.css.sass (used for main layout).

When i issue:

RAILS_ENV=production bundle exec rake assets:precompile

it compiles my coffeescripts and javascripts. There are no error messages in the log. It's like it doesn't even try to compile sass files.

The main.css.sass file header looks like this:

//=depend_on "_globals.css.sass" @import globals

The _glocals.css.sass exists in the same directory.

最满意答案

詹姆斯是对的,这是可能的解决方案之一。

将所有文件添加到一个清单文件的缺点是所有文件都会预编译为单个文件 - 这并不总是您想要的。

在我的情况下,我需要单独的文件(每个布局一个文件)。

如何添加新的清单文件:

config.assets.precompile += %w( file1.css file2.css )

你不需要有实际的file1.css ,如果你有file1.css.sass ,它将被预编译。

James is right and it's one of the possible solutions.

The drawback of adding all files to one manifest file is that all will be precompiled to single file - which isn't always what you want.

In my case I needed separate files (one file for each layout).

Heres how to add new manifest files:

config.assets.precompile += %w( file1.css file2.css )

You don't need to have actual file1.css, if you have file1.css.sass it will be precompiled.

更多推荐

本文发布于:2023-04-29 03:53:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1334495.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:管道   资产   SASS   compile   pipeline

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!