sanscheese / gridsome-source-craft-graphql

10 stars 1 forks source link

Handle routes and templates for other Element Types #1

Open sanscheese opened 4 years ago

sanscheese commented 4 years ago

The source plugin currently handles entries. It should be able to handle other craft element types (Categories, Assets, Tags, Users).

To accomplish this will be better for the templates structure to be flat rather than having subfolders i.e: Entry - ${typeName}${elementType}${sectionHandle}${entryHandle}.vue Category - ${typeName}${elementType}${groupHandle}.vue

For example (GOOD): Entry - src/templates/craftEntryNewsArticle.vue Category - src/template/craftCategoryBlogCategory.vue

Rather than how the current setup is heading towards (BAD): Entry: src/templates/news/article.vue Category: src/templates/craftCategory/blogCategory.vue

dguillory commented 4 years ago

Makes sense to me. It might be nice to separate with underscores for legibility, since all the camelcasing blends together. Something like: src/templates/craft_entry_blogPosts_post.vue

sanscheese commented 4 years ago

Intial work on this is done for templates. But still requires the live preview setup to be worked on.

@dguillory am going to stick with Pascal case as more inline with Vue standards. May have more flexibility in the template paths/filename formats in the future.

sanscheese commented 4 years ago

The basics of this are done for https://github.com/sanscheese/gridsome-source-craft-graphql/releases/tag/v0.0.13 but leaving open as can be better implemented and cleaned up (and live preview handling)