Default Template 2.0 - feedback
See original GitHub issueWe’re currently working on Default theme 2.0 - the design process is on its way. I think this is the right time to gather some feedback regarding code architecture/structure as well. This ticket is for that - please feel free to include Your voice in the discussion
What is the motivation/use case for changing the behavior or adding a new feature?
Default Theme in its current state is getting a little bit messy. After being one year in the business we also have some ideas how to make things simpler. On the design layer, on the other hand, we do have a lot of ideas on how to improve User Experience.
Tech feedback
Here we go with the ideas on how to improve the architecture of the themes
Too granular mixins
- I think we should avoid a “two-liner” mixins like https://github.com/DivanteLtd/vue-storefront/blob/master/core/modules/cart/features/isMicrocartOpen.ts. These small mixins are very difficult to even discover by developers, the comment + brackets generate more lines than the core logic (which is just … .Vuex call). On the other hand, it makes the compile process longer (IO operation to import the module etc.). Moreover, it makes theme development more difficult (You have to create a lot of these mixins to meet good practices). I think we should keep things simple the core components were easy to understand and use for theme developers. If we’re to keep the features in
module/features
we should rather have kind of bundled mixins (with a set of features) - but this makes core components redundant.
I’m a fan of making things simpler and we should stay with core components + features that really do something (other than just calling Veux actions). Modules are a great idea but in this forms make a little good to the project. They make it more difficult to understand.
Current theme was thought of single/central theme without modularization as the scope of the theme is from my perspective too thin to divide it to modules (and the effects are these too granular mixins in my opinion).
We should aim more at WordPress/Shopify approach NOT Magento approach regarding themes.
Too complicated directory structure
- We do have sth like:
/theme/components/core/
/theme/components/theme/
/theme/components/core/blocks
/theme/components/theme/blocks
We should simplify it - we don’t need blocks
folder and probably don’t need theme
as well. I think that the theme should be divided into sections corresponding to Pages and Components (maybe modules) + one “Common” folder - that’s all.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:9 (2 by maintainers)
Top GitHub Comments
Yo guys! So I agree with @pkarw default theme it’s getting messy. Generally we should start thinking more about functional/dumb components. But what we have now…
@pkarw
Too granular mixins
I know what you feel, but I agree absolutely with @filrak. From my perspective I would like to choose what I need use in my components than maintenance part of code which I don’t need. Comments are not problem because are not occur in build code.
Now we have small mixins where you can find just vuex call - right, but we never know what we will need to add to logic of these mixins later. We should keep some level of abstraction from Vuex. If we build some serious and simple documentation (https://vuejs.org/v2/api/ should be good example for us 😍) there will be no problems to find accurate mixin.
Now we give user core components build from feature mixins and this is great because he may take whole cart module with all needed logic. But again some of users may want to use only specific mixin and this is the point for us. Trust us 😉
Too complicated directory structure
I could not agree more with you. I think user may not know what is core component and what is theme component. I think blocks was nice idea, but we lost the track what it should be exactly 😄
@DavidRouyer
Totally agree. New default theme or base set of components should be consist of only dumb / functional components. We shouldn’t keep the “data” logic in components like this. They should works only based on props.
@HRR1337
I’m not advocating for rely on some CSS frameworks in application such like VS. Stupid example with flexbox grid with some wrong padding calculation on mobile devices. We had a lot of problems to refactore current theme to flexbox grid 2 😰 because a lot of components was using flexboxgrid classes and what worse some part of our code overwrite default code of flexboxgrid - nightmare.
Few of my thoughts
We should pull out themes from our code base. Theme should be external package which user can maintain. Users should be able to update VS core without some hardcore merge.
Core logic components - we should give user all needed logic to create specific part of shop like cart, product page, checkout etc. I think we are on the good way with api features and core components like cart.
If we want to give possibility to simple and quickly customize we have to create some set of base theme components:
to be continued…
@jorkvist we’re all committed to fix v1 as well 😃