millermedeiros/requirejs-plugins — pull request #29 by krawaller (2013-07-19 08:27:25+00:00)
Title: Make loading add ".json" if missing from path

Forcing the user to include ".json" in the path seems to clash with the API of other plugins that are designed to load a specific type of file (coffee-script, jade, etc). These plugins expects the user to enter the filename without the filetype ending.

This commit makes the JSON plugin adhere to that convention by adding ".json" to the path, but to make sure existing usage won't break it first checks if it isn't already there.

This will however break for people who try to load JSON from files ending in something other than .json, but they should learn better anyway, right? :)

The text plugin upon which this plugin is modelled is different as there are a multitude of file types which could conceivably be loaded as text (html, htm, txt, etc).