Stolz / Assets

An ultra-simple-to-use assets management library for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for files not ending in CSS or JS

jeff-ottinger opened this issue · comments

This is just a suggestion.

I recently ran into an issue adding the following css file to the 'autoload' array:

http://fonts.googleapis.com/css?family=Racing+Sans+One

I was able to work around this issue by adding a parameter with '.css' as the value so that the regex would pick it up, like this:

http://fonts.googleapis.com/css?family=Racing+Sans+One&.css

However, this isn't very clean. Here are two options:

  1. Add two new config options 'autoloadcss' and 'autoloadjs' which force the associated array items to be loaded as either CSS or Javascript
  2. Add support for a 'js' or 'css' key to the 'autoload' array, which would contain a sub-array of the items you want to force loaded as either CSS or Javascript.

Thanks

commented

@jeff-ottinger I just changed how the asset type is determined to a much more flexible approach.

Now instead of using the extension the filename/url is matched against a regex pattern than can be customized via config options. So now you decide what is a JS/CSS asset, not me or the extension.

You can see the default values for the regexs in the API docs.