Made document editing possible
This commit is contained in:
4
vendor/kriswallsmith/assetic/.gitignore
vendored
Normal file
4
vendor/kriswallsmith/assetic/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
phpunit.xml
|
||||
vendor/
|
||||
composer.phar
|
||||
composer.lock
|
2
vendor/kriswallsmith/assetic/composer.json
vendored
2
vendor/kriswallsmith/assetic/composer.json
vendored
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "kriswallsmith/assetic",
|
||||
"minimum-stability": "dev",
|
||||
"description": "Asset Management for PHP",
|
||||
"keywords": ["assets", "compression", "minification"],
|
||||
"homepage": "https://github.com/kriswallsmith/assetic",
|
||||
@@ -20,6 +21,7 @@
|
||||
"twig/twig": ">=1.6.0,<2.0",
|
||||
"leafo/lessphp": "*"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"suggest": {
|
||||
"twig/twig": "Assetic provides the integration with the Twig templating engine",
|
||||
"leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler"
|
||||
|
@@ -25,6 +25,7 @@ use Symfony\Component\Process\ProcessBuilder;
|
||||
class CompassFilter implements FilterInterface
|
||||
{
|
||||
private $compassPath;
|
||||
private $rubyPath;
|
||||
private $scss;
|
||||
|
||||
// sass options
|
||||
@@ -50,9 +51,10 @@ class CompassFilter implements FilterInterface
|
||||
private $generatedImagesPath;
|
||||
private $httpJavascriptsPath;
|
||||
|
||||
public function __construct($compassPath = '/usr/bin/compass')
|
||||
public function __construct($compassPath = '/usr/bin/compass', $rubyPath = null)
|
||||
{
|
||||
$this->compassPath = $compassPath;
|
||||
$this->rubyPath = $rubyPath;
|
||||
$this->cacheLocation = sys_get_temp_dir();
|
||||
|
||||
if ('cli' !== php_sapi_name()) {
|
||||
@@ -133,6 +135,11 @@ class CompassFilter implements FilterInterface
|
||||
$this->plugins[] = $plugin;
|
||||
}
|
||||
|
||||
public function setLoadPaths(array $loadPaths)
|
||||
{
|
||||
$this->loadPaths = $loadPaths;
|
||||
}
|
||||
|
||||
public function addLoadPath($loadPath)
|
||||
{
|
||||
$this->loadPaths[] = $loadPath;
|
||||
@@ -171,11 +178,16 @@ class CompassFilter implements FilterInterface
|
||||
// compass does not seems to handle symlink, so we use realpath()
|
||||
$tempDir = realpath(sys_get_temp_dir());
|
||||
|
||||
$pb = new ProcessBuilder(array(
|
||||
$compassProcessArgs = array(
|
||||
$this->compassPath,
|
||||
'compile',
|
||||
$tempDir,
|
||||
));
|
||||
);
|
||||
if (null !== $this->rubyPath) {
|
||||
array_unshift($compassProcessArgs, $this->rubyPath);
|
||||
}
|
||||
|
||||
$pb = new ProcessBuilder($compassProcessArgs);
|
||||
$pb->inheritEnvironmentVariables();
|
||||
|
||||
if ($this->force) {
|
||||
@@ -330,12 +342,12 @@ class CompassFilter implements FilterInterface
|
||||
|
||||
// does we have an associative array ?
|
||||
if (count(array_filter(array_keys($array), "is_numeric")) != count($array)) {
|
||||
foreach($array as $name => $value) {
|
||||
foreach ($array as $name => $value) {
|
||||
$output[] = sprintf(' :%s => "%s"', $name, addcslashes($value, '\\'));
|
||||
}
|
||||
$output = "{\n".implode(",\n", $output)."\n}";
|
||||
} else {
|
||||
foreach($array as $name => $value) {
|
||||
foreach ($array as $name => $value) {
|
||||
$output[] = sprintf(' "%s"', addcslashes($value, '\\'));
|
||||
}
|
||||
$output = "[\n".implode(",\n", $output)."\n]";
|
||||
|
@@ -30,6 +30,7 @@ class SassFilter implements FilterInterface
|
||||
const STYLE_COMPRESSED = 'compressed';
|
||||
|
||||
private $sassPath;
|
||||
private $rubyPath;
|
||||
private $unixNewlines;
|
||||
private $scss;
|
||||
private $style;
|
||||
@@ -41,9 +42,10 @@ class SassFilter implements FilterInterface
|
||||
private $noCache;
|
||||
private $compass;
|
||||
|
||||
public function __construct($sassPath = '/usr/bin/sass')
|
||||
public function __construct($sassPath = '/usr/bin/sass', $rubyPath = null)
|
||||
{
|
||||
$this->sassPath = $sassPath;
|
||||
$this->rubyPath = $rubyPath;
|
||||
$this->cacheLocation = realpath(sys_get_temp_dir());
|
||||
}
|
||||
|
||||
@@ -99,7 +101,12 @@ class SassFilter implements FilterInterface
|
||||
|
||||
public function filterLoad(AssetInterface $asset)
|
||||
{
|
||||
$pb = new ProcessBuilder(array($this->sassPath));
|
||||
$sassProcessArgs = array($this->sassPath);
|
||||
if (null !== $this->rubyPath) {
|
||||
array_unshift($sassProcessArgs, $this->rubyPath);
|
||||
}
|
||||
|
||||
$pb = new ProcessBuilder($sassProcessArgs);
|
||||
|
||||
$root = $asset->getSourceRoot();
|
||||
$path = $asset->getSourcePath();
|
||||
|
@@ -19,9 +19,9 @@ namespace Assetic\Filter\Sass;
|
||||
*/
|
||||
class ScssFilter extends SassFilter
|
||||
{
|
||||
public function __construct($sassPath = '/usr/bin/sass')
|
||||
public function __construct($sassPath = '/usr/bin/sass', $rubyPath = null)
|
||||
{
|
||||
parent::__construct($sassPath);
|
||||
parent::__construct($sassPath, $rubyPath);
|
||||
|
||||
$this->setScss(true);
|
||||
}
|
||||
|
@@ -80,11 +80,10 @@ abstract class BaseCompressorFilter implements FilterInterface
|
||||
|
||||
// input and output files
|
||||
$tempDir = realpath(sys_get_temp_dir());
|
||||
$hash = substr(sha1(time().rand(11111, 99999)), 0, 7);
|
||||
$input = $tempDir.DIRECTORY_SEPARATOR.$hash.'.'.$type;
|
||||
$output = $tempDir.DIRECTORY_SEPARATOR.$hash.'-min.'.$type;
|
||||
$input = tempnam($tempDir, 'YUI-IN-');
|
||||
$output = tempnam($tempDir, 'YUI-OUT-');
|
||||
file_put_contents($input, $content);
|
||||
$pb->add('-o')->add($output)->add($input);
|
||||
$pb->add('-o')->add($output)->add('--type')->add($type)->add($input);
|
||||
|
||||
$proc = $pb->getProcess();
|
||||
$code = $proc->run();
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
if (!$loader = @include __DIR__.'/../vendor/.composer/autoload.php') {
|
||||
if (!$loader = @include __DIR__.'/../vendor/autoload.php') {
|
||||
die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
|
||||
'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
|
||||
'php composer.phar install'.PHP_EOL);
|
||||
@@ -43,4 +43,4 @@ if (isset($_SERVER['PACKAGER'])) {
|
||||
|
||||
if (isset($_SERVER['PACKER'])) {
|
||||
require_once $_SERVER['PACKER'];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user