3

我有这个文件 app/assets/stylesheets/config.rb 包含以下内容:

http_path = "/"
css_dir = "."
sass_dir = "."
images_dir = "img"
javascripts_dir = "js"
output_style = :compressed
relative_assets=true
line_comments = false

它是干什么用的?

4

3 回答 3

5

要回答您的问题“它是做什么用的”,它是 Compass scss 编译器的配置。另一个答案中的参考资料很方便,但要获取最新的详细信息,无需猜测,请在此处查看 Compass 配置文件的详细信息:

http://compass-style.org/help/tutorials/configuration-reference/

我最初发布的目的还在于提供文件来源的答案(如果您不是自己创建的。我回答这个问题是因为它“神奇地”出现在我的 Rails 项目中,并且谷歌搜索生成 config.rb在 Rails 中结束在这里。我首先怀疑 sass-rails,但该项目中的某个人确认他们没有生成该文件。然后我发现该文件的自动生成是由带有 LiveReload 包的 Sublime Text 引起的。见相关的github 问题

于 2013-03-01T00:11:04.953 回答
0

我猜它定义了如何从样式表文件夹中查找资产,以及一些关于资产在发送到客户端浏览器之前发生的情况的输出选项。

http_path = "/"              <= probably the root path to assets, so if you had
                                application.css, the URL path to it would be
                                http://example.com/application.css
css_dir = "."                <= the directory to look for css files. "." in linux
                                means "the current directory", so this would set you
                                CSS path to app/assets/stylesheets
sass_dir = "."               <= same as above, except for .sass/.scss files
images_dir = "img"           <= images go in app/assets/stylesheets/img
javascripts_dir = "js"       <= javascript go in app/assets/stylesheets/js
                                (seems like a strange place to put them)
output_style = :compressed   <= either to produce .gzip'ed versions of files
                                or to minify them, maybe both - consult docs on this
relative_assets=true         <= relative, as opposed to absolute paths to assets, I think
line_comments = false        <= I think this turns on/off the ability to include comments,
                                or maybe whether the comments are included in the
                                compressed versions of the file. turn it to "true" and
                                compare the assets, as served to the browser, and see
                                what the difference is
于 2013-02-21T15:09:03.990 回答
0

您可以通过从 Sublime Text 中删除 Live Reload 插件来修复它。

Sublime Text > Preferences > Package Control > Remove Package > Live Reload

对我来说,这是一个很好的解决方案,因为我没有使用 Live Reload。谁使用实时重新加载请关注问题:github

于 2013-04-22T13:06:48.377 回答