Add ability to strip arbitrary prefix #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In response to #5
This feature adds the ability to strip an arbitrary prefix from the input file name.
In our last two projects, we found it difficult to figure out how to strip a prefix from a file name to be placed into the key of the $templateCache.put(). We wished there was a way to simply strip some arbitrary prefix, but that feature did not exist. We saw the -b/--basedir option, but we could not figure out how to use it properly. As a result, we found ourselves having to change directories to the level where the relative path to the file would wind up being what we wanted to see in the key of the $templateCache.put(). This was a drag. It seems others have also had similar issues with the --basedir option. So, we added the ability to strip an arbitrary prefix.
The behavior of the feature is specified in the tests that accompany this pull request.
In short, to strip an arbitrary prefix, run the following:
./path/to/ng-html2js path/to/file.tmpl -s path/to/
this will yield:
$templateCache.put('file.tmpl', 'the-rest-of-the-magic-goodness')