addyosmani/critical

Remove query string from stylesheet path

オープン

#551 opened on 2023/01/31

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (457 件のフォーク)batch import
bughelp wanted

Repository metrics

Stars
 (9,902 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

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.

コントリビューターガイド