question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ RFP ] Theming Storefront UI

See original GitHub issue

Question

The concept that I would like to see being widely used with Storefront UI is theming capability.

Let’s say someone is willing to make custom SFUI theme to use components in his/her app. Are in-component SCSS vars enough to fulfill this need OR we need to think about CSS as a theme so sfui css = default theme, custom css = other theme.

Idea 1

Current - via SCSS vars

Idea 2

Treating CSS as a theme while keeping HTML and JS as SFUI base.

In vue package we have everything needed for components to work, in shared package we have icons and styles so basically everything that could be consider a theme.

StorefrontUI should support theming capabilities which means you should be able to simply replace shared package as a source of assets and styles for your components.

To make this possible we need two things:

  • generic HTML (we will make sure our components HTML is generic before releasing beta)
  • good API for theming

In theory every component should look more or less like this

<script src="@storefrontui/vue/SfBreadcrumbs.js"></script>
<template lang="html" src="@storefrontui/vue/SfBreadcrumbs.html"></template>
<style lang="scss">
// theme css
</style>

But it requires people to actually create all those components. It would be much better if we could just override paths to default SCSS stylesheets. Even though the idea seems right I’m struggling with finding a proper way of handling this.

Having such theming mechanism may potentially make our in-component SCSS vars redundant. Maybe we are trying to fulfill too many use cases with them instead of providing a general solution.

Please let me know what do you think about this idea and if possible propose how such theming API should work. Also please lmk if you think we still need in-component SCSS vars with such system. Let’s make it great together 😉

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
leomp12commented, Jun 19, 2019

Second option sounds better, but I’m not sure if it works well with more complex components, even if we found a great API. At the truth, I think SASS variables is good enough, I just think we should use more global variables, but it’s also harder to style components with global variables then with internal ones, as we’re doing now. Maybe on next version we can do this migration from internals to globals (not only globals, but as possible).

1reaction
filrakcommented, Jun 24, 2019

@leomp12 I agree that moving as global as possible is the way to go. In a long run I was thinking about replacing SCSS vars with CSS vars so we can make a WYSIWYG editor of this vars (with pages from examples folder on live preview) so people can adjust the vars and generate sfui.scss file. Going more global with vars will help with that a lot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[RFP] New Checkout structure · Issue #270 - GitHub
Make the checkout fields really dynamic - manageable 100% in the theme. · The Vuex store of order and checkout should be merged...
Read more >
Welcome - Page ⋅ Storybook - Storefront UI
Storefront UI is designed and built based on two main concepts as below: Design inspired from Google Retail UX Playbook. Atomic Design pattern...
Read more >
How To Customize Storefront UI - YouTube
Storefront UI is the default UI library that is shipped out of the box with any Vue Storefront project.This video explains three ways...
Read more >
How to use the eCommerce RFP template?
Storefront design and layout options are available through your e-commerce platform. · Using any theme from our collection will allow you to ...
Read more >
Theme | Vue Storefront 2
This page will describe what makes the default theme, how to customize it, ... This means that some integrations might have more pages,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found