addyosmani/critical

Remove query string from stylesheet path

開放

#551 建立於 2023年1月31日

 (0 則留言) (0 個反應) (0 位負責人)JavaScript (457 個分叉)batch import
bughelp wanted

倉庫指標

星標
 (9,902 顆星)
PR 合併指標
 (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.

貢獻者指南