ignore files in config.rb
this is my dir structure
css/
sprites/_sprite.scss
scss/important.scss
scss/file1.scss
...
scss/file5.scss
scss/file6.scss
scss/file7.scss
scss/file8.scss
scss/file9.scss
scss/file10.scss
I want to be able to use
compass watch
to monitor changes to scss/important.scss file ONLY. I know about
compass watch scss/important.scss
But I want to achieve the same just using a config file conf.rb so I can use compass like that
compass watch
Why I want to do this? Because I want to run compass via Guard. I know that in Guard I can watch certain files but it doesn't help me as compass always rebuilds all the scss files regardless of what Guard watches.
The reason I want to build only one scss file is because I use compass to generate PNG sprite and it takes 5 seconds for each scss where that sprite is imported. Way too long to use Guard with LiveReload (11 x 5s !!!).
prefixing the other SCSS files with "_" is not an option.
I just want compass to watch one file without having to specify this file as a command line argument
OK, I have two ideas maybe can help you.
move your sass files to another directory except for main.scss, name that directory whatever you want, for example: includes
. Then put additional_import_paths = 'path/to/includes'
, leave sass_dir
as it used to be. Finally in your main.scss
import other files. Now, compass knows the dependencies for main.scss
but won't compile those files because they stay in an independent directory.
But there's a littler issue left: how to compile them in production environment? Well, compass allows us to specify environment variable like environment = :production
(and its default value is :development
). With this help, you can write your sass_dir
as sass_dir = (environment == :production) ? 'path/includes/main' : ['path/includes/main', 'path/includes/others']
sass_dir = (environment == :production) ? 'path/includes/main' : ['path/includes/main', 'path/includes/others']
, and execute command: compass compile -e production
at the final stage.
Write a bash alias like: alias mycompass="compass watch scss/main.scss"
, and you know it. use mycompass
for your own work, leave compass as it should be.
What I eventually did was:
I run
compass watch scss/important.scss
in one console and
guard -i
in another console. I set up Guard to watch on CSS file cachanges and do LiveReload. I removed compass from my guard configuration. Now it all works as I expected except I have to keep two terminals open.
链接地址: http://www.djcxy.com/p/91672.html上一篇: 在PhpStorm中设置指南针
下一篇: 忽略config.rb中的文件