Codekit Compass vs Less compilation when spriting

2019-08-05 10:33发布

问题:

I recently moved from using Less to using Compass. I use Codekit, but dont use the built in Compass compiler due to it having problems when using plugins. Now my issue is that the compilation is significantly longer compared to Less. I have realized that this is due to it generating sprites on each compile. Is there a way to turn this off? IE, only compile when I have a certain customization in place. I looked at the customization, and there is no way to set a customization property that tells when and when not to compile a new sprite. In other words I would like to tell the compiler manually when to generate the sprite.

Anyone else have a solution?

回答1:

What I have decided to do, since I cannot find a solution anywhere, is to create a separate sprite.scss file that imports and manages my sprites. When I have a new image that needs to be attached to a sprite, I compile the sprite.scss. Now I have a sprite.css file. I copy the contents of the sprite.css file into a partial _sprites.scss and import that into my main.scss file. Now I can use extends etc within my main.scss file. I know that sounds extremely cumbersome, but it cuts down my compilation time from 30-60s secs to less than 2 secs.

Anyone else have a solution I am all ears.