罗盘:您必须从项目目录中编译单个样式表 [英] compass: You must compile individual stylesheets from the project directory

查看:50
本文介绍了罗盘:您必须从项目目录中编译单个样式表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前一段时间,我使用罗盘从sass生成项目的样式表。

A while ago I was using compass to generate stylesheets from sass for a project.

最近我回到了那个项目。我去了sass目录并做了 compass watch --debug。:。
这会产生错误您必须从项目目录编译单个样式表。

Recently I returned to that project. I went to my sass directory and did "compass watch --debug .:." This generated the error "You must compile individual stylesheets from the project directory".

我发现目录中没有config.rb。所以我重新创建了一个。看起来像这样:

I discovered that there was no config.rb in the directory. So I recreated one. It looks like this:

http_path = "/"
css_dir = "/css"
sass_dir = "/css"
images_dir = "/img"
javascripts_dir = "/js"
preferred_syntax = :sass

但是,无论我在配置中输入什么值,所有使用罗盘的尝试都会导致相同的错误。

However, all of my attempts to use compass result in the same error, no matter what values I put in the config.

我如何获得指南针来实际处理我的Sass?

How do I get compass to actually process my sass?

推荐答案

也遇到了这个问题,Arnaud Valle的评论已经回答了这个问题。
但是为了清楚起见,人们随后进行搜索。

just came across this problem too, and it has already been answered in the comment by Arnaud Valle. But just for clarity, and people later searching.

仅创建config.rb是行不通的,因为指南针无法识别它。
答案是切换到您的项目目录(root),然后运行

Just creating a config.rb will not work, as compass does not recognise it. The answer is just switch to your project directory(root) and then run

compass init

然后将在sass目录中创建一个有效的 config.rb,以及两个名为sass的目录和样式表

This will then create you a "working" config.rb, and two directories called sass, and stylesheets, in the sass directory will be a couple of start scss files.

如果不想使用它们,或者想使用其他目录,那么现在当然可以编辑新创建的工作配置.rb,并更改您的目录(然后删除自动创建的旧目录)

If you do not want them, or want to use different directories, you can of course now edit your freshly created and working config.rb, and change your directories (and then delete the old automatically created ones)

哦,我怀疑您的js不在文件夹javascripts中,因此请将其编辑为在config.rb

Oh and i suspect your js will not be in a folder javascripts, so edit that to in the config.rb

无论如何(无论是否这样做),您都应该能够运行

Anyway having done that(or not) you should then be able to run

compass watch

一切都应该很好,即您的scss文件被编译为css文件

and all should be good , i.e. your scss files get compiled to css files

作为我没有尝试过的替代方法,但从理论上讲

As an alternative that I have not tried, but theoretically

compass compile [path/to/scss]

如果您不想初始化指南针,也应该可以使用

should work too, if you don't want to init compass

更多信息可在指南针文档中找到此处

More information to be found in the compass documentation here

并完全超越顶部,如果您经常这样做,并且讨厌默认设置,则将以下内容编辑/添加到您的〜中/.bash_profile

and to go completely over the top, if this is something you find yourself doing often, and hate the defaults then edit/add the following to your ~/.bash_profile

alias compass_init="compass init --syntax=sass --css-dir=css --javascripts-dir=js"

这篇关于罗盘:您必须从项目目录中编译单个样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆