loader - incorporate logic from gallery-pathogen-encoder module 

This pull request incorporates the logic from <a href=https://github.com/yui/yui3-gallery/blob/master/src/gallery-pathogen-encoder/README.md>gallery-pathogen-encoder</a> for encoding modules for the pathogen codec.