addyosmani/critical

Remove query string from stylesheet path

Aperta

#551 aperta il 31 gen 2023

 (0 commenti) (0 reazioni) (0 assegnatari)JavaScript (457 fork)batch import
bughelp wanted

Metriche repository

Star
 (9902 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

In my simple PHP file I reference my stylesheet as follows:

<link rel="stylesheet" href="css/style.css?v=<?php echo filemtime( 'css/style.css' ); ?>"

When using the CLI, I get the following error:

Error: File not found: css/style.css?v=<?php echo filemtime( 'css/style.css' ); ?>

This could be addressed by automatically removing query strings like ?v before trying to access the file. After that it works as expected.

Guida contributor