kaystrobach / TYPO3.dyncss

Dyncss base extension - Donate if you like it http://donate.kay-strobach.de/
http://forge.typo3.org/projects/extension-dyncss
GNU General Public License v2.0
9 stars 27 forks source link

Caching issue in development environment #38

Closed somedia-mkohler closed 7 years ago

somedia-mkohler commented 7 years ago

Hi Kay

What a awesome extension. Nice work.

Our company implemented your extension in some websites. During implementation and testing we found an issue in the caching mechanism.

It depends on following environment: Typo3 7.6, dyncss 0.7.9, dyncss_scss (1.0.5), Environment mode: Development

Everything is ok, when the whole Typo3 page is cached. But if we use a uncached Extbase plugin or a uncached Typoscript object (COA_INT, USER_INT) the SASS file gets compiled on each page load. Next step i took a look in the code of the dyncss extension and saw a logical problem in the evaluation if a file has been modified. Please, correct me if i'm wrong.

it affects following file: Classes\Parser\AbstractParser.php

On line 260 you check, if the modification time of the prepared file is younger than the modification time of the input file. If so, the SASS file gets compiled. But after the compilation is done, you delete (unlink) the prepared file. On the next page load the same condition returns TRUE, because the prepared file does not exists (@filemtime() returns FALSE). I think the condition should check if the output file is younger than the input file.

With this modification on line 260 it will work: if(@filemtime($outputFilename) < @filemtime($inputFilename) || $this->_checkIfCompileNeeded($inputFilename)) {

Do i misundestand something or is this a bug? Thank you for your feedback.

Best regads Michael

kaystrobach commented 7 years ago

@somedia-mkohler sounds like a bug - could you please create a PR for that, would be awesome.

If you've never done this before the following tutorial might help / or you use the webinterface for that simple RFC 😄 https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github

kaystrobach commented 7 years ago

thank you!