addyosmani/critical

Remove query string from stylesheet path

Open

#551 opened on Jan 31, 2023

View on GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (457 forks)batch import
bughelp wanted

Repository metrics

Stars
 (9,902 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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.

Contributor guide