Feature/1092 twig namespaces #1093
Merged
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.
Currently we're finding the twig partial folder by splitting the path based on the namespace ID (i.e. Atoms). This works well if we're using the atomic naming convention but not so much for others. At work we use Drupal theme names as our twig namespaces so this breaks in new and wondrous ways for us.
This PR updates how the
fullFolderPath
is generated. Instead of splitting on namespace ID we're splitting on the resolved namespace path. This allows us to leave the ID out of it while still figuring our the correct partial folder.Before:
tempPartial = '/Users/foo/Sites/pattern-lab/source/_patterns/05-test/00-test.twig'
selectedNamespace[0].id = 'some_thing'
fullFolderPath = '/Users/foo/Sites/pattern-lab/source/_patterns/05-test/00-test.twigsome_thing'
After:
tempPartial = '/Users/foo/Sites/pattern-lab/source/_patterns/05-test/00-test.twig'
selectedNamespace[0].paths[index] = 'source/_patterns/05-test'
fullFolderPath = '/Users/foo/Sites/pattern-lab/source/_patterns/05-test'
Closes #1092