Add .js to combined assets

Hello,

It would be great to add .js extension to combined JS files.

Cause actually, the file looks like this :

https://www.mywebsite.com/combine/c10e5ef0d0d4b292f77b24564c7ae88e-1670839598

With some hosts, it can bring some problems. With plesk for example, I get this error :

Refused to execute script from 'https://www.mywebsite.com/combine/055643b60f539d6fb30ace263faf2198-1670839598' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

It can probably be fixed on the server side (didn’t find solution yet so I disabled minification), but it would be even better in my opinion to keep the file extension. Even minified and combined, it’s still .js after all.

What do you think about it ? Is there a good reason to not keep the file extension on combined files ?

Best regards,

Alex

It can probably be fixed on the server side (didn’t find solution yet so I disabled minification), but it would be even better in my opinion to keep the file extension. Even minified and combined, it’s still .js after all.

Just put .js or .css after combined tag in Twig, it will fetch the same resource as without it.

1 Like

Example:

<link href="{{ ['assets/less/theme.less']|theme }}.css" rel="stylesheet">

Smart, I didn’t think about it.