teamcfadvance / cfstatic

CfStatic is a framework for managing the inclusion and packaging of CSS and JavaScript in CFML applications.
https://teamcfadvance.github.io/cfstatic
MIT License
102 stars 35 forks source link

cfstatic does not error when an included file does not exist #95

Closed boughtonp closed 11 years ago

boughtonp commented 11 years ago

This is noted as deliberate functionality in the usage guide - "If you attempt to include a package or file that does not exist, CfStatic will not throw an error." - but it is neither helpful nor expected behaviour.

There should be a configuration option for whether an error is thrown (and in the next major version, ideally throwing an error should become the default).

DominicWatson commented 11 years ago

I agree, it should be a configuration option. Also an optional argument to the include method. The default will not be changing though. Will get this in asap.

DominicWatson commented 11 years ago

Done the code, now to update the docs... I'll bundle this with the next release.

DominicWatson commented 11 years ago

This is in the develop branch ready for imminent release with 0.7.0. The updated docs can be seen here:

http://dominicwatson.github.io/cfstatic/full-guide.html#useage

I believe that keeping the default of "false", no errors thrown, is the right choice because:

  1. maintains backward compatibility
  2. checking for missing includes in production is either a) redundant, b) undesirable (I'd rather have a missing include than a 500 error for my end users)

Closing.

boughtonp commented 11 years ago

Cool, thanks for the quick turnaround. :)

I disagree with your rational on the default though - a missing include can means an ugly or broken page, and might go unreported - whereas a proper error can get caught, logged, and notifications sent, so it gets noticed and fixed sooner.

DominicWatson commented 11 years ago

I hear you, but still don't entirely agree - given that two people disagree I'm not sure its worth breaking backward compatibility (I'd personally need to reconfigure all sites that are using it). The config option should keep everyone happy enough :)