markstory / asset_compress

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.
MIT License
370 stars 125 forks source link

Cannot compile SVG #351

Closed jiru closed 4 years ago

jiru commented 4 years ago

I am not sure if this is a bug or a feature request, so let me just explain my problem.

I have a lot of small SVG icons and I would like to use asset_compress to pack them into a single SVG file that I can reuse as described here.

I thought all I had to do was to create my own filter and to declare it in the INI file. Something like this:

[svg]
paths = WEBROOT/img/**
cachePath = WEBROOT/cache_svg/
filters[] = MySVGPackingFilter

[allicons.svg]
files[] = icons/*.svg

However it looks like this doesn’t work because the list of allowed extensions is hardcoded and doesn’t include SVG.

Can I solve this problem without modifying asset_compress? If not, what would be the best approach to modify asset_compress so that it can do what I want?

markstory commented 4 years ago

I think adding svg as an extension type makes sense. If you send a pull request I can merge it and do a release.