/** * Bootstraps the application. * * This method is called after all services are registered * and should be used for "dynamic" configuration (whenever * a service must be requested). * * @param Application $app * @throws \InvalidArgumentException */ public function boot(Application $app) { $app['assetic.filters'] = $app->share($app->extend('assetic.filters', function ($filters) use($app) { $filters['compass'] = $app->share(function () use($app) { $filter = new CompassFilter($app['assetic.filter.compass.bin'], $app['assetic.ruby.bin']); $filter->setScss($app['assetic.filter.compass.scss']); $filter->setUnixNewlines($app['assetic.filter.compass.unix_newlines']); $filter->setNoCache($app['assetic.filter.compass.no_cache']); $filter->setForce($app['assetic.filter.compass.force']); $filter->setQuiet($app['assetic.filter.compass.quiet']); $filter->setTimeout($app['assetic.filter.compass.timeout']); $filter->setDebugInfo($app['assetic.filter.compass.debug']); $filter->setBoring($app['assetic.filter.compass.boring']); $filter->setNoLineComments($app['assetic.filter.compass.no_line_comments']); $filter->setStyle($app['assetic.filter.compass.style']); $filter->setImagesDir($app['assetic.filter.compass.images_dir']); $filter->setFontsDir($app['assetic.filter.compass.fonts_dir']); $filter->setRelativeAssets($app['assetic.filter.compass.relative_assets']); $filter->setJavascriptsDir($app['assetic.filter.compass.javascripts_dir']); $filter->setHttpPath($app['assetic.filter.compass.http_path']); $filter->setHttpImagesPath($app['assetic.filter.compass.http_images_path']); $filter->setHttpFontsPath($app['assetic.filter.compass.http_fonts_path']); $filter->setHttpGeneratedImagesPath($app['assetic.filter.compass.http_generated_images_path']); $filter->setGeneratedImagesPath($app['assetic.filter.compass.generated_images_path']); $filter->setHttpJavascriptsPath($app['assetic.filter.compass.http_javascripts_path']); $filter->setPlugins($app['assetic.filter.compass.plugins']); $filter->setLoadPaths($app['assetic.filter.compass.load_paths']); $filter->setHomeEnv($app['assetic.filter.compass.home_env']); $filter->setCacheLocation($app['assetic.filter.compass.cache_location']); return $filter; }); return $filters; })); }
public function setFilters() { if (get_option('am_use_compass', 0) != 0) { //Defines compass filter instance and sprite images paths $compassInstance = new CompassFilter(get_option('am_compass_path', '/usr/bin/compass')); $compassInstance->setImagesDir(get_theme_root() . "/" . get_template() . "/images"); $compassInstance->setGeneratedImagesPath($this->manager->cache->getPath()); $compassInstance->setHttpGeneratedImagesPath(site_url() . str_replace(getcwd(), '', $this->manager->cache->getPath())); $this->setFilter('Compass', $compassInstance); $filter = 'Compass'; } else { $this->setFilter('Scssphp', new ScssphpFilter()); $filter = 'Scssphp'; } $this->setFilter('CssRewrite', new CssRewriteFilter()); }
/** * Takes all the SASS stylesheets and manages their queue to asseticize them */ public function generateSass() { if (empty($this->sass)) { return false; } $mtime = md5(implode('&', $this->mTimesSass) . implode('&', $this->sass)); //If SASS stylesheets have been updated -> compass compile if (!$this->cache->has("sass-{$mtime}.css")) { if (get_option('am_use_compass', 0) != 0) { //Defines compass filter instance and sprite images paths $compassInstance = new CompassFilter(get_option('am_compass_path', '/usr/bin/compass')); $compassInstance->setImagesDir(get_theme_root() . "/" . get_template() . "/images"); $compassInstance->setGeneratedImagesPath($this->assetsPath); $compassInstance->setHttpGeneratedImagesPath(site_url() . str_replace(getcwd(), '', $this->assetsPath)); $this->css->getFilterManager()->set('Compass', $compassInstance); $filter = 'Compass'; } else { $this->css->getFilterManager()->set('Scssphp', new ScssphpFilter()); $filter = 'Scssphp'; } //Saves the asseticized stylesheets $this->cache->set("sass-{$mtime}.css", $this->css->createAsset($this->sass, array($filter, 'CssRewrite'))->dump()); } //Adds SASS compiled stylesheet to normal css queue $this->styles['sass-am-generated'] = $this->assetsPath . "sass-{$mtime}.css"; $this->mTimesStyles['sass-am-generated'] = filemtime($this->styles['sass-am-generated']); }
protected function getFilterCompass() { $assetPath = $this->assetPath(); $cachePath = $this->cachePath(); $compass = new CompassFilter('/usr/local/bin/compass'); $compass->setHttpPath('/assets/'); $compass->setImagesDir($assetPath . '/img'); $compass->setHttpGeneratedImagesPath('img'); $compass->setGeneratedImagesPath($cachePath . '/img'); $compass->setJavascriptsDir($assetPath . '/js'); $compass->setHttpJavascriptsPath('assets/js'); $compass->setNoCache(true); $compass->setScss(true); return $compass; }