Ability to select which files to update when updating a theme


(Joe) #1

forgive my ignorance of how Github works :sweat_smile:

  • Discourse themes can be installed by cloning
  • Discourse themes can include both html and CSS (scss)
  • Discourse themes can be updated by re-cloning the theme’s repository in it’s current state
  • Updating a theme means that any customization added after installing the theme is lost.

Proposed feature

Add the ability to choose which files to update when updating a theme from the admin.

Use case

Let’s say I create a footer theme component.

The theme component includes 2 files - common.scss and footer.html

Now let’s - for example - say that common.scss includes the following:

#fancyfooter {
padding: 20px;
}

And footer.html includes the following:

<footer id="fancyfooter">
<a href="#">Facebook</a>
</footer>

Now a user sees my theme component and thinks, “hey, I want something like this on my Discourse!” So they install the component.

Now the user wants to change the the link to that of their actual Facebook page, so they change footer.html to the following:

<footer id="fancyfooter">
<a href="https://www.facebook.com/spongebob/">Facebook</a>
</footer>

So far so good.

A week later I, the theme component author get a bug report that there’s too much padding and it’s causing overlap, so I update common.scss and now it looks like this in the repo

#fancyfooter {
padding: 10px;
}

Now the version installed on the user from the above example’s Discourse is outdated. The user has two choices, either maintain the local version and match the changes manually, or update and lose all their customization to footer.html Both options are not ideal.


Allowing the user to choose which files to update means they can choose to only update the common.scss and keep footer.html untouched - their customization - adding their own Facebook page would still be preserved.


Here’s a basic mock up of what I imagine it would look like:

Check for updates:

Updates present:

Modal with options for which files to update:

Bonus:

Don’t show inapplicable options. For example if the theme only has common.scss files and footer.html files then the modal should not show the other options like Header and and After Header.


(Sam Saffron) #3

I worry about the feature creep here, instead I feel that theme vars and better support for theme components is the way to go.

Update “my amazing footer” is way better than “update only header css”


(Joe) #4

YES! :smile:

I saw the feature request for theme settings and I would completely ditch the idea in this topic for theme settings / variables any day of the year. I like simple :ok_hand:

This can be closed :wine_glass:


(Sam Saffron) #5