Possible to prevent theme updates from replacing user customized assets?


#1

I’ve run into an interesting dilemma. It’s a little tricky to explain, so let me know if I need to clarify anything.

My intention is have a hard-coded variable name (like $image-url) in the SCSS file that will point to an image asset. The idea is to allow users to upload their own image assets to the theme component, naming them to match the variable names in the SCSS file. The goal is to keep it easy for the user so they won’t need to edit anything in the CSS/HTML.

Here are the issues I am running into:

  • If I have the $image-url variable in the SCSS file without a matching asset (listed under Uploads in the theme), I get an undefined variable error when trying to save the SCSS file (which makes sense)

  • If I try to set default values for the variables in the SCSS file, it overrides the values defined in the uploaded theme assets

  • I tried using the about.json file to set each variable to placeholder.png and include that asset with the theme component, but the catch here is that every time I update it, any assets the user had set are replaced with the placeholders again

Any suggestions on how to handle this, or is it just a limitation that I will have to explain to the users?


(Sam Saffron) #2

I think we want a special flag for placeholders so they are skipped from updates. Feels like a feature request to me.

I think you could have a second theme component maybe that defines the assets? ask them to install both, a yucky workaround though.


#3

I did think about that. It is pretty yucky, but it might be one of the only options for now.