Assetic Compass filter
This project is now DEPRECATED. Currently there are better alternatives, please use those in new projects.
The better Compass integration for your PHP project.
For forking and other funnies:
This Assetic filter:
width: image-width(@SomeBundle:public/myimage.png);
gem install compass-connector
{
"require": {
"glorpen/assetic-compass-connector": "*"
}
}
There are four kinds of "paths":
@MyBundle:public/images/asset.png
/, should only be used in resolving on-disk file and url prefixing, it is always a public file//, http:// etc. and will NOT be changed by connectorSome examples:
@import "@SomeBundle:scss/settings"; /* will resolve to src/SomeBundle/Resources/scss/_settings.scss */
@import "foundation"; /* will include foundation scss from your compass instalation */
width: image-size("@SomeBundle:public/images/my.png"); /* will output image size of SomeBundle/Resources/public/images/my.png */
background-image: image-url("@SomeBundle:public/images/my.png"); /* will generate url with prefixes given by Symfony2 config */
@import "@SomeBundle:sprites/*.png"; /* will import sprites located in src/SomeBundle/Resources/sprites/ */
This filter's Assetic name is compass_connector.
You can compile assets as in any Assetic filter:
<?php
use Glorpen\Assetic\CompassConnectorFilter\Filter;
use Glorpen\Assetic\CompassConnectorFilter\Resolver\SimpleResolver;
use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
$resolver = new SimpleResolver(
"ResourcesDir/", "outputDir/"
);
$f = new Filter($resolver, 'path/to/cache', 'path/to/compass/bin');
$f->setPlugins(array("zurb-foundation")); //or array("zurb-foundation"=>">4")
$f->addImport('/path/to/some/scss/dir'); //and then @import "scss_in_some_dir";
$css = new AssetCollection(array(
new FileAsset('path/to/file.scss'),
), array( $f ));