New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Moving Assets

Florian Jahn March 5, 2021 by Florian Jahn


We are planning to refactor a couple of asset files. However, all of them are probably in use somewhere across the page. I am aware that I cannot simply move around the asset files and expect Statamic to track the movement. I would have to adjust the paths in all entries.

I was thinking about doing it the following way:

  • Put the assets folder into version control (git).
  • Commit the before-state.
  • Move the assets around as you want them to be.
  • Commit the after-state in a new commit.
  • Extract all rename-changes from that new commit.
  • Replace all occurrences of the old paths with the new ones across all files in the content-directory using sed.

While this should be possible, it seems very hacky and cumbersome.

Have you encountered this problem as well? Does someone have an idea on how to solve this issue in a more sane way?

Answered by Erin Dalzell!
>>>>>>> Answered <<<<<<<
2 Replies