64 if (
'cli' !== php_sapi_name()) {
144 $this->plugins[] = $plugin;
196 $compassProcessArgs =
array(
201 if (null !== $this->rubyPath) {
202 $compassProcessArgs = array_merge(explode(
' ', $this->rubyPath), $compassProcessArgs);
212 $pb->add(
'--output-style')->add($this->
style);
220 $pb->add(
'--boring');
223 if ($this->noLineComments) {
224 $pb->add(
'--no-line-comments');
230 if ($this->imagesDir) {
231 $pb->add(
'--images-dir')->add($this->imagesDir);
234 if ($this->relativeAssets) {
235 $pb->add(
'--relative-assets');
238 if ($this->javascriptsDir) {
239 $pb->add(
'--javascripts-dir')->add($this->javascriptsDir);
242 if ($this->fontsDir) {
243 $pb->add(
'--fonts-dir')->add($this->fontsDir);
247 $optionsConfig =
array();
250 $optionsConfig[
'additional_import_paths'] =
$loadPaths;
253 if ($this->unixNewlines) {
254 $optionsConfig[
'sass_options'][
'unix_newlines'] =
true;
257 if ($this->debugInfo) {
258 $optionsConfig[
'sass_options'][
'debug_info'] =
true;
261 if ($this->cacheLocation) {
265 if ($this->noCache) {
266 $optionsConfig[
'sass_options'][
'no_cache'] =
true;
269 if ($this->httpPath) {
273 if ($this->httpImagesPath) {
277 if ($this->httpFontsPath) {
281 if ($this->httpGeneratedImagesPath) {
285 if ($this->generatedImagesPath) {
289 if ($this->httpJavascriptsPath) {
294 if (count($optionsConfig)) {
296 foreach ($this->plugins as $plugin) {
297 $config[] = sprintf(
"require '%s'", addcslashes($plugin,
'\\'));
299 foreach ($optionsConfig as $name => $value) {
300 if (!is_array($value)) {
301 $config[] = sprintf(
'%s = "%s"', $name, addcslashes($value,
'\\'));
302 } elseif (!empty($value)) {
307 $configFile = tempnam($tempDir,
'assetic_compass');
308 file_put_contents($configFile, implode(
"\n",
$config).
"\n");
309 $pb->add(
'--config')->add($configFile);
312 $pb->add(
'--sass-dir')->add(
'')->add(
'--css-dir')->add(
'');
315 if (null !== $this->scss) {
316 $type = $this->scss ?
'scss' :
'sass';
319 $type = pathinfo(
$path, PATHINFO_EXTENSION);
324 $tempName = tempnam($tempDir,
'assetic_compass');
328 $input = $tempName.
'.'.$type;
331 if (
defined(
'PHP_WINDOWS_VERSION_MAJOR')) {
332 $input = str_replace(
'\\',
'/', $input);
336 file_put_contents($input, $asset->
getContent());
341 if ($this->homeEnv) {
347 $proc = $pb->getProcess();
348 $code = $proc->run();
352 if (isset($configFile)) {
359 $asset->
setContent(file_get_contents($output));
363 if (isset($configFile)) {
377 if (count(array_filter(array_keys($array),
"is_numeric")) != count($array)) {
378 foreach ($array as $name => $value) {
379 $output[] = sprintf(
' :%s => "%s"', $name, addcslashes($value,
'\\'));
383 foreach ($array as $name => $value) {
384 $output[] = sprintf(
' "%s"', addcslashes($value,
'\\'));
static fromProcess(Process $proc)
filterDump(AssetInterface $asset)
Filters an asset just before it's dumped.
setGeneratedImagesPath($generatedImagesPath)
getSourcePath()
Returns the relative path for the source asset.
formatArrayToRuby($array)
setHttpFontsPath($httpFontsPath)
setPlugins(array $plugins)
createProcessBuilder(array $arguments=array())
Creates a new process builder.
__construct($compassPath='/usr/bin/compass', $rubyPath=null)
setRelativeAssets($relativeAssets)
getContent()
Returns the loaded content of the current asset.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
static getTemporaryDirectory()
setHttpJavascriptsPath($httpJavascriptsPath)
setNoLineComments($noLineComments)
setCacheLocation($cacheLocation)
getSourceDirectory()
Returns the asset's source directory.
An asset has a mutable URL and content and can be loaded and dumped.
Create styles array
The data for the language used.
setHttpGeneratedImagesPath($httpGeneratedImagesPath)
setHttpImagesPath($httpImagesPath)
setJavascriptsDir($javascriptsDir)
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
filterLoad(AssetInterface $asset)
Filters an asset after it has been loaded.
setUnixNewlines($unixNewlines)
setContent($content)
Sets the content of the current asset.
mergeEnv(ProcessBuilder $pb)