मुझे पता है कि यह एक पुराना विषय है, लेकिन एकमात्र उत्तर जो मैं ठीक कर सकता हूं, वह CompassElephantBundle और उपरोक्त AsseticController हैक था। मेरे पास एक दृष्टिकोण है जो अनिवार्य रूप से है लेकिन इसका मतलब है कि मुझे विक्रेता पैकेज को संपादित करने की आवश्यकता नहीं थी।
जिस तरह से मैंने इसे किया है, वह मूल एसेटिक नियंत्रक की प्रतिलिपि संपादित करना और उसके बाद पैरामीटर से कॉन्फ़िगरेशन में लिंक करना है।
parameters:
assetic.controller.class: Acme\RandomBundle\Controller\AsseticController
की नकल की AsseticController सिर्फ स्रोत पथ से फ़ाइल प्रकार के लिए एक preg_match करता है और वहाँ से कैशिंग ठीक कर दे।
<?php
/* Original Assetic Controller */
public function render($name, $pos = null)
{
if (!$this->enableProfiler && null !== $this->profiler) {
$this->profiler->disable();
}
if (!$this->am->has($name)) {
throw new NotFoundHttpException(sprintf('The "%s" asset could not be found.', $name));
}
$asset = $this->am->get($name);
if (null !== $pos && !$asset = $this->findAssetLeaf($asset, $pos)) {
throw new NotFoundHttpException(sprintf('The "%s" asset does not include a leaf at position %d.', $name, $pos));
}
$bustCache = preg_match('/\.(scss|sass|less)$/', $asset->getSourcePath());
$response = $this->createResponse();
$response->setExpires(new \DateTime());
if ($bustCache) {
$lastModified = time();
$date = new \DateTime();
$date->setTimestamp($lastModified);
$response->setLastModified($date);
}
else
{
// last-modified
if (null !== $lastModified = $asset->getLastModified()) {
$date = new \DateTime();
$date->setTimestamp($lastModified);
$response->setLastModified($date);
}
}
// etag
if ($this->am->hasFormula($name)) {
$formula = $this->am->getFormula($name);
$formula['last_modified'] = $lastModified;
$response->setETag(md5(serialize($formula)));
}
if ($response->isNotModified($this->request)) {
return $response;
}
if ($bustCache) {
$response->setContent($asset->dump());
}
else {
$response->setContent($this->cachifyAsset($asset)->dump());
}
return $response;
}
/* Rest of controller */
मैं ** कम ** के साथ सिम्फनी का उपयोग करता हूं और यह प्रत्येक अनुरोध पर इसे पुन: संकलित करता है, जब तक कि वास्तविक वास्तविक फ़ाइल में परिवर्तन होते हैं और उस से आयात की गई फ़ाइलों में नहीं। शायद यह तुम्हारी समस्या है? – solarc