Thanks, Joe!
Even though I have read your documentation before, as well as most posts on GitHub and a few of your posts on the forum, it was still very hard to figure things out. I must say that only through luck (reading this post of yours, where you mentioned “But remember to include the default mount”) and hours spent did I figure out how to do this. Such a simple thing should be easy! But it isn’t, due to the lack of real-life examples in the documentation. Replacing the project’s symlinks isn’t straightforward, as many things are implied.
Anyway, I will share how it worked for us, and I hope that it was done correctly and that it will help someone else save hours of time. We also very much hope that it won’t stop working in the future.
We have two projects, for which one project (parent) was sharing things with the other project (child) using symlinks. It was done this way to share code and easily fix bugs across two similar projects.
We use the same theme across both projects, on top of which we build our own modifications, using custom.css
file in the parent project and custom_.css
. There are tons of other files were linked across the parent and child projects using symlinks.
This is how we ended up making it work considering that the child and parent are in the same directory, i.e.:
/home/ilia/Git/parent-example.com
/home/ilia/Git/child-example.com
The symlinks were replaced as follows:
module:
mounts:
- source: layouts
target: layouts
- source: ../parent-example.com/layouts/docs/list.html
target: layouts/docs/single.html
- source: ../parent-example.com/layouts/docs/list.html
target: layouts/docs/list.html
- source: ../parent-example.com/layouts/shortcodes/badge.html
target: layouts/shortcodes/badge.html
- source: ../parent-example.com/layouts/shortcodes/link.html
target: layouts/shortcodes/link.html
- source: ../parent-example.com/layouts/shortcodes/hotkey.html
target: layouts/shortcodes/hotkey.html
- source: ../parent-example.com/layouts/partials/main-buttons.html
target: layouts/partials/main-buttons.html
- source: assets
target: assets
- source: ../parent-example.com/assets/css/extended/custom.css
target: assets/css/extended/custom.css
- source: ../parent-example.com/assets/js/extended/docs-filetree.js
target: assets/js/extended/docs-filetree.js
- source: ../parent-example.com/assets/js/extended/docs-toc.js
target: assets/js/extended/docs-toc.js
- source: ../parent-example.com/assets/js/extended/header.js
target: assets/js/extended/header.js
- source: ../parent-example.com/assets/js/extended/footer.js
target: assets/js/extended/footer.js
imports:
- path: "../../parent-example.com/themes/MyTheme"
mounts:
- source: assets
target: assets
- source: i18n
target: i18n
- source: layouts
target: layouts
What was hard to figure out?
- First of all it’s implied that we needed to do:
- source: assets
target: assets
and
- source: layouts
target: layouts
… otherwise, nothing would work as expected. The logic for symlinks is different, and guessing those two extra steps in particular wasn’t straightforward.
… furthermore it isn’t clear if we have to use:
mounts:
- source: assets
target: assets
- source: i18n
target: i18n
- source: layouts
target: layouts
For the theme part or just putting:
imports:
- path: "../../parent-example.com/themes/MyTheme"
… is enough? It seems that it works just fine without it? But why?