paularmstrong/swig — pull request #329 by alexscheelmeyer (2013-09-20 08:11:45+00:00)
Title: Added support for import-paths

Hi

I have added support for a new setting : "importPaths" which is an array of foldernames used by the parseFile function to resolve filenames. This makes it possible in the import tag to import macros from files without any path trusting that the proper include-paths have been set.

I need this to be able to make a npm package that encapsulates some functionality that includes both code for the backend and some swig templates for the templating. Using this I can have a folder inside the npm package that is added to the include-paths and when the package us updated, the templates will also be updated. I could just reference relatively from the template into the node_modules folder but I find that to be an ugly hack since that is not how it works for require'ing code.

I did a new testcase as well as a base testcase for the regular import-tag to make sure it works to actually import macros, something that was not tested before as far as I can see.

Alex