Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't update theme, changes to *.hbs files do not render consistently #44

Closed
codechair opened this issue Jan 23, 2020 · 18 comments
Closed
Labels
support Support Ticket

Comments

@codechair
Copy link

codechair commented Jan 23, 2020

Describe the bug
I cannot update the theme (nothing at all, not even a simple removal of the link to Facebook on footer).

To Reproduce

  1. Fork this repo, let's call the fork "Ghostified"
  2. Fork the theme https://github.com/TryGhost/Lyra, let's call that fork "GhostifiedTheme"
  3. Do first changes like adjusting the footer removing the facebook link (just comment out line 35 in default.hbs) in "GhostifiedTheme"
  4. Commit changes to "GhostifiedTheme"
  5. Point to "GhostifiedTheme" inside package.json in "Ghostified" (look for dependencies --> lyra)
  6. run npm install --production to update package-lock.json
  7. Go to Heroku --> Manual deploy --> Deploy Branch
  8. Your changes will have successfully propagated to production, The Facebook link will have disappeared

This is when things NO longer propagate:

  1. Do additional changes to "GhostifiedTheme", like comment out line 36 in default.hbs to also remove the Twitter link
  2. like previously: Commit changes to "GhostifiedTheme"
  3. like previously: run npm install --production to update package-lock.json
  4. this won't make package-lock.json point to the latest commit on "GhostifiedTheme", so run npm update lyra, package-lock.json will now point to the latest commit on "GhostifiedTheme"
  5. Go to Heroku --> Manual deploy --> Deploy Branch
  6. Your changes will NO longer propagate to production, The Twitter link will not have disappeared (Please note: the Facebook link has not returned - from the top part of this "To Reproduce" -, it persisted )

Expected behavior
Be able to change the theme via my forked theme of a supported Ghost Theme (i.e. Lyra). In other words, to be able to customise "GhostifiedTheme" and have the changes propagate

How are you deploying this?
Deployment on Heroku from fork of this repo

@codechair codechair added the bug Something isn't working label Jan 23, 2020
@SNathJr
Copy link
Owner

SNathJr commented Jan 23, 2020

Hey @codechair
So, my first guess off the top of my head would be that, the deployment script is replacing your edited theme. Maybe you can try removing the theme's dependency from package.json and copy themes shell file as well. Let us know how it goes.

Cheers!
SNathJr

@codechair
Copy link
Author

Thanks a ton for reverting so quickly @SNathJr

I get removing the dependency from package.json

Can you clarify what you mean with "copy themes shell file as well" please?

@SNathJr
Copy link
Owner

SNathJr commented Jan 23, 2020

Oh, I am sorry for not being specific. It's the copy-themes.sh file in bin folder.

Also, make sure you put your edited theme in content/themes folder.

@codechair
Copy link
Author

codechair commented Jan 23, 2020

Thanks and how do I make the contents in content/themes be readable?

Changes to them right now do not show up as changes in Github. So I can't commit them.

@SNathJr
Copy link
Owner

SNathJr commented Jan 23, 2020

@codechair Try with the .gitignore file. There would be content/themes/*.

Also, if you would not want to do all that, you could simply create your own fork of the theme and point to that theme in the dependancy. That would be a better approach, as well.

@codechair
Copy link
Author

codechair commented Jan 23, 2020

Super ultra thanks @SNathJr ! Priceless help... 4h of my day ended up rescued by you :)

For others in the future going through the same (just as per suggestion from above from @SNathJr) The following worked:

  1. Remove "lyra": "github:myforkrepo/lyra-forked", from package.json (obs the path to your theme fork would be here)
  2. Remove "lyra" from copy-themes.sh file in bin folder.
  3. For the lyra theme have the following in your .gitignore file (as opposed to content/themes/*)
content/themes/attila
content/themes/bleak
content/themes/casper
content/themes/london
content/themes/massively
content/themes/pico 
content/themes/the-shell
content/themes/vapor

And to follow-up on your final note @SNathJr , sadly the fork only "worked" upon the first npm install --production all subsequent changes to the theme did not propagate. See the second part of "To reproduce" in #44 (comment). I was working with a fork of the theme all along. This bit was the strangest of it all (only updating the markup the first time I've deployed a dependency - or changed the dependency - . I kept on moving between my fork and Ghost's original theme to confirm this and yes, the custom markup only changed/rendered if I'd move the dependency back to Ghost's theme repo and then back to my fork of the theme again).

Or did I misunderstand you with "fork of the theme"?

@JaneJeon
Copy link
Collaborator

JaneJeon commented Jan 23, 2020

the fork only "worked" upon the first npm install --production

@codechair well, that would be because, as we say time and time again, Heroku does NOT persist anything locally outside of what's already in your slug.

So the ONLY way to get this to persist every single time would be to just point Lyra (or whatever theme) to your own theme (e.g. "Lyra": "github:codechair/my-lyra-fork"), then copy-themes.sh will handle the rest.

Do you have at least one "release" in your forked theme repository?

@SNathJr we've had to repeat ourselves about Heroku not persisting any local file changes (including themes) again and again and again. We really should 1. update "bug" reports template to point anyone regarding this to #9, 2. add documentation, 3. aggressively close any issue about this. Maybe it might also be a good idea to explain in the README how heroku works (only the slug is persisted) and tell people to debug their own stuff (e.g. "if something only works the first time, chances are, it's not part of the slug")

@codechair
Copy link
Author

codechair commented Jan 23, 2020

Thanks for reverting @JaneJeon, I believe you misunderstood me.

I was pointing all dependencies to my own fork of the theme (See the second part of "To reproduce" in ##44 (comment)). So, unsure what you mean?

@SNathJr SNathJr added support Support Ticket and removed bug Something isn't working labels Jan 23, 2020
@JaneJeon
Copy link
Collaborator

JaneJeon commented Jan 23, 2020

@codechair

  1. You should only need to point only the dependency that you changed into your own fork, so when you say "I was pointing all dependencies" it tells me that you're doing something wrong.
  2. It's likely that your reference to your fork ("pointing") was wrong. Where is the forked theme repository and how did you "point" to it in your package.json (give links for both)? I don't believe that you did it correctly, so unless you can show me how exactly you did it I can't help you.
  3. You ignored the part where I asked if you had any "release" in your forked theme repository.

@codechair
Copy link
Author

codechair commented Jan 23, 2020

@JaneJeon

Just redid it all again and here it comes "all dependencies" was a typo as indeed this is about one dependency (this was also clear from my "To Reproduce" #44 (comment)):

Then the process to lock package-lock.json as per #44 (comment) "To reproduce"

@SNathJr
Copy link
Owner

SNathJr commented Jan 23, 2020

@JaneJeon I believe, @codechair needed help with how the repo works, and how github handles gitignore and gitkeep.

As far as I understand, @codechair wants to edit lyra theme in their fork and was not able to load it on deploy.

This was probably because of gitignore file ignoring content/themes and replacing it with original theme from tryghost. (@codechair correct me if I am wrong).

The solution was hence to create their own fork of theme with wanted changes and add it to dependencies. Or to add it in the folder manually and remove the code that replaces it.

The scope of this ticket should have been support (not bug).

@codechair
Copy link
Author

codechair commented Jan 23, 2020

This was probably because of gitignore file ignoring content/themes and replacing it with original theme from tryghost. (@codechair correct me if I am wrong).

@SNathJr the funny part of this is that the original content would not completely override the theme, the changes from the first part of "To reproduce" #44 (comment) would persist on and on, but any new changes (second part of "To reproduce" #44 (comment) ) would not propagate.

@SNathJr
Copy link
Owner

SNathJr commented Jan 23, 2020

@JaneJeon Being at work, I believe I did not read that fully and assumed @codechair needed help with replacing the theme with their edited version. 😅

Also, closing this issue as it seems to have been solved by the OP.

@SNathJr SNathJr closed this as completed Jan 23, 2020
@JaneJeon
Copy link
Collaborator

@SNathJr funny you should say that, I'm also at work xD

@codechair
Copy link
Author

codechair commented Jan 28, 2020

Getting back to this issue:

I had solved the issue by reading the theme files directly from my fork of this repo as per kind guidance from @SNathJr .

I'm however struggling with this approach now given I still need to do styling changes in the separate theme (Lyra) fork (in assets > css), then build the screen.css in assets > built with yarn, then manually copy those files over to the theme now living in my fork of this repo.

That is a lot of back and forth.

Any chance you'd have any idea on how to actually read from the separate theme fork without suffering from the inconsistencies I've referred to on the first comment to this issue?

I'm not opening a new issue since this history is very relevant to why I've moved to using the theme files in the repo.

And as a clean way to replicate what I've mentioned top of this thread, I'm prepared the repos so you can have a look at, clean:

Then the process to lock package-lock.json as per #44 (comment) "To reproduce"

@SNathJr
Copy link
Owner

SNathJr commented Jan 29, 2020

Hey @codechair

I am not sure that I understand your question properly. Could you please be a little bit more specific? Maybe give a step by step procedure of what you were doing and what went wrong.

SNathJr

@SNathJr SNathJr reopened this Jan 29, 2020
@codechair
Copy link
Author

codechair commented Jan 29, 2020

Sure @SNathJr , here it comes:

Describe the bug
I cannot update the theme if:

  • theme is in another repo
  • the theme is pointed to my fork of this repo as a dependency
  • the update that does not propagate is not the first change
  • the first change made to the theme persists
    (nothing at all, not even a simple removal of the link to Facebook (no html nor css) on footer propagates when it is the second update).

To Reproduce

  • Fork this repo, let's call the fork "Ghostified"
  • Fork the theme https://github.com/TryGhost/Lyra, let's call that fork "GhostifiedTheme"
  • Do first changes like adjusting the footer removing the facebook link (just comment out line 35 in default.hbs) in "GhostifiedTheme"
  • Commit changes to "GhostifiedTheme"
  • Point to "GhostifiedTheme" inside package.json in "Ghostified" (look for dependencies --> lyra)
  • run npm install --production to update package-lock.json
  • Go to Heroku --> Manual deploy --> Deploy Branch
  • Your changes will have successfully propagated to production, The Facebook link will have disappeared

This is when things NO longer propagate:

  • Do additional changes to "GhostifiedTheme", like comment out line 36 in default.hbs to also remove the Twitter link
  • like previously: Commit changes to "GhostifiedTheme"
  • like previously: run npm install --production to update package-lock.json
    this won't make package-lock.json point to the latest commit on "GhostifiedTheme", so run npm update lyra, package-lock.json will now point to the latest commit on "GhostifiedTheme"
  • Go to Heroku --> Manual deploy --> Deploy Branch
  • Your changes will NO longer propagate to production, The Twitter link will not have disappeared (Please note: the Facebook link has not returned - from the top part of this "To Reproduce" -, it persisted )

Expected behavior
Be able to change the theme via my forked theme of a supported Ghost Theme (i.e. Lyra). In other words, to be able to customise "GhostifiedTheme" and have the changes propagate

How are you deploying this?
Deployment on Heroku from fork of this repo

Please let me know if you’d like any other details.

JaneJeon added a commit that referenced this issue Jan 29, 2020
@JaneJeon
Copy link
Collaborator

JaneJeon commented Jan 29, 2020

Ignore what I said previously. @codechair I believe I have already mentioned to you above that a possible solution is to version your theme. However, you still not have tried it and AFAIK it is a surefire way to update the theme within heroku.

To version your theme, you MUST make a new GitHub release and update the specific version number.

As for @SNathJr, I believe we need to explicitly say we do not support developing (or specifically, what this guy wants - “hot reposing”) on heroku. Your repo and theme must be prepped locally and then pushed up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Support Ticket
Projects
None yet
Development

No branches or pull requests

3 participants