2013-03-31 29 views
0

當你有一個使用sass @import導入其他的包裝樣式表,並且當使用guard來監視變化時,如果你只改變一個導入的文件,它不會自動編譯包裝樣式表。例如:Guard沒有編譯所有的SCSS樣式表

/* This is viewports.scss, which must compile into viewports.css */ 
@media only screen and (min-width: 480px) { 
    @import "480.scss"; 
} 

@media only screen and (min-width: 768px) { 
    @import "768.scss"; 
} 

@media only screen and (min-width: 1024px) { 
    @import "1024.scss"; 
} 

當修改例如480up.scss,它編譯如預期進入480up.css,但警衛不其導入到viewports.css,好像是不承認的依賴。當你想在一個編譯的css中實現響應時,這個用法很重要,但是將你的代碼寫入單獨的scss文件。

如果你只是使用sass命令,你有預期的行爲,如果你使用Guard,而不是。

有沒有一些解決方法呢?額外的東西,我需要配置?

回答

0

Guard不知道任何關於文件的依賴性,只是提供基礎來輕鬆處理文件系統修改事件。我看到有兩個衛兵插件青菜:

我會選擇後衛 - 薩斯,因爲它是積極的維護。當我正在閱讀文檔時,我看到

:smart_partials => true # Causes guard-sass to do dependency resolution and only 
         # recompile the files that need it when you update partials. 
         # If not on, then guard-sass will update all files when a 
         # partial is changed. 
         # default: false 

因此,看起來guard-sass應該已經可以正確處理您的問題了。

相關問題