2013-02-21 230 views
3

我有這個文件app /資產/樣式表/ config.rb具有以下內容:軌資產樣式config.rb

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

又是什麼呢?

+0

我注意到剛發生的應用程序中發生的同樣的事情。該應用程序使用sass軌道,但不是指南針。我想知道是什麼導致config.rb文件生成。 – 2013-03-04 17:51:05

+0

我和@WizardofOgz有完全相同的問題並想通了。我在下面回答了這兩個問題。 – tehfoo 2013-03-07 18:48:38

回答

5

要回答你的問題「它是什麼」,它是Compass scss編譯器的配置。在對方的回答中引用是很方便,但最新的細節,而不會炒作退房指南針配置文件在這裏的細節:

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

我原本張貼還提供了該文件的答案來自(如果你自己沒有創建它,我回答這個是因爲它在我的Rails項目中出現了「神奇」,並且在Rails中搜索生成config.rb的谷歌搜索結果在這裏結束,我首先提到了sass-rails,但是那個項目的人證實他們沒有生成那個文件,然後我發現這個文件的自動生成是由帶有LiveReload包的Sublime Text造成的。請參閱相關的github issue

+1

非常棒!我永遠不會想到崇高造成的問題。因爲我的同事沒有遇到這個問題,所以我瘋了。 LiveReload軟件包卸載後,一切恢復正常。修復程序發佈後,我將重新安裝該軟件包。 – 2013-03-07 22:49:06

+1

是的,它也讓我發瘋。配置文件,我願意讓幻燈片,但當每次我救了15 foo.css文件開始彈出......這種事情讓我超級不高興。必須要做些事情。 – tehfoo 2013-03-09 19:01:33

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 
+0

無需猜測,配置的參考位於Compass網站上:http://compass-style.org/help/tutorials/configuration-reference/ – tehfoo 2013-03-01 00:14:11

0

您可以通過從Sublime Text中刪除Live Reload插件來修復它。

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

對我來說這是很好的解決方案,因爲我沒有使用Live Reload。 誰使用實時重新加載請按照問題:github