SwiftGen / templates

Stencil templates for SwiftGen
MIT License
13 stars 38 forks source link

Reorganize templates in subdirectories #1

Closed AliSoftware closed 7 years ago

AliSoftware commented 7 years ago

I suggest that instead of having all templates flatten in a big templates directory, we should make images/fonts/colors/ … subdirectories.

Especially since now that we'll have a dedicated repository to host templates, that would help organise them.

But also that would allow that directory structure to map the future directory structure for the template documentation which I intend to structure similarly.

djbe commented 7 years ago

While I've implemented this in this repo, while implementing this on the SwiftGen repo's side (CLI), it becomes a breaking change: The CLI will look in both the internal templates directory, but also in the application support templatesdirectory. If we change the code for how it searches for templates, we should make it consistent for both directories (internal and app support).

This is the patch:

-  var path = appSupportTemplatesPath + "\(prefix)-\(templateShortName).stencil"
+  var path = appSupportTemplatesPath + prefix + "\(templateShortName).stencil"
   if !path.isFile {
-    path = bundledTemplatesPath + "\(prefix)-\(templateShortName).stencil"
+    path = bundledTemplatesPath + prefix + "\(templateShortName).stencil"
AliSoftware commented 7 years ago

Note that if we do that in SwiftGen 5.0, we must not forget to update the help message for swiftgen templates list accordingly as well.