Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect re-use of CSS-file #17

Open
MarkMagStream opened this issue Jun 18, 2014 · 6 comments
Open

Incorrect re-use of CSS-file #17

MarkMagStream opened this issue Jun 18, 2014 · 6 comments

Comments

@MarkMagStream
Copy link

The function _getCacheName uses the last_modified timestamp to generate a unique filename.

In my case, I use the same LESS files for 2 different page templates, except for 1 LESS file (which depends on the page template used). So I should get a different CSS file in this template.
But unfortunately the 2 LESS files that differ have exactly the same last_modified timestamp, so the same filename is generated for the CSS file. This results in incorrect classes in the CSS file included in 1 of the pages.

@FlipZoomMedia
Copy link
Owner

Sehr geehrte Damen und Herren,

vielen Dank für Ihre Nachricht. Ich bin vom 16. bis einschließlich 29. Juni 2014 nicht im Haus und werde mich umgehend nach meiner Wiederkehr um die Beantwortung Ihrer E-Mail kümmern.

Beste Grüße,
David Karich

FlipZoom Media Inc.
David Karich
Sieglarer Straße 65 - 67
53842 Troisdorf

Tel.: +49(0) 22 41 · 90 53 40-4
Mobil: +49(0) 1 71 · 7 40 85 51
E-Mail: info@flipzoom.de
Web: www.flipzoom.de

Inhaber: David Karich
St.-Nr.: 220 / 5211 / 1444
USt-IdNr.: DE285718045
Amtsgericht: Siegburg

@sb3d
Copy link

sb3d commented Jun 27, 2014

Why use modtime? I often FTP a few files to the server in less than a second and they all become identical when cached because the modtime is the same. I'm trying this out instead:

private static function _getCacheName($files, $prefix = 'css_', $ext = '.css') {
    $_pathtext = '';
    foreach ($files as $file) {
        $_pathtext .= $file['absolute_path'];
    }
    return (self::$developmentMode !== true) ? $prefix.md5($_pathtext).$ext : $prefix.md5($_pathtext).'_dev'.$ext;
}

Other than that, this module has been a joy to use. Thanks.
(SteveB on PW forum)

@marvinscharle
Copy link
Collaborator

Hello sb3b and MarkMagStream,

we're looking for a different solution to handle in the next major version. I personally like the idea of sb3d to use a md5.

Thanks for reporting!

@marvinscharle marvinscharle added this to the AIOM 4 milestone Oct 20, 2014
@craigrodway
Copy link

Thanks to forum member SteveB pointing me to this, which I totally missed when I searched for the problem!

I had a similar issue, and came up with a solution like sb3d; but I used the modified timestamp as well as the path. If the timestamp isn't present, I'd be concerned that the same cache file name would be generated all the time, even when they change. When changes are made to the source files, the generated file will have the same name, and so could still be cached by browsers.

@foobarlab
Copy link

I also had an issue with duplicate md5 hashes as I could not rely on the modified timestamp. After deployment of my website via FTP all css files had the same timestamp. I used also both the absolute path and the modified timestamp which made it work for me.

@phlppschrr
Copy link

Why is this simple fix still not included? I can't see any reason to not fix this issue now, even if you are already planning the next major release.

phlppschrr added a commit to phlppschrr/ProcessWire-AIOM-All-In-One-Minify that referenced this issue Mar 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants