Closed toto975 closed 1 month ago
In which scenario would you want to have an empty CSS or JS file? Especially since you should only generate the hashes in production.
I know it seems pointless to have empty css or js files. But I have an integration template which contains link=... for css and <script src=... for the js which is common. Given the number of times it is used, it is easier to have empty css and js files rather than testing in the model the cases where I should integrate them or not.
I understand, however this is very specific to your use case. Given that you shouldn’t include empty resource files in production I don’t really see the benefit to add this.
I might revisit this in the future if I ever decide to rewrite the library, but for now I prefer to not include this.
When using Sri::hash with an empty file, it goes to Exception "file not found" (Sri.php line 94). The file exists, but its size is 0 and its content is empty. A hash can anyway be calculated.
Maybe lines 93-95 can be removed