I am looking for an option to set up path aliasing in my Zola config to pass to grass. Here is my use case and my high level approach on how I would approach a PR.
Use Case: I have two front end projects (one built with Zola, the other with Vite/Vue) and a common folder in a monorepo. They are laid out as described below. I would like to share some common css among them. (I’d also eventually be able to share web components, but I thought sass was the simpler request.)
- app (Vue)
- company-site (Zola)
- common (me trying to save myself a maintenance headache with similar visuals but quite different build requirements)
Approach: Looking at the grass code, we could pass something for
load_paths as documented here: https://github.com/connorskees/grass/blob/6888cdcb8690e21fb30e224febc5cd0459c2c2e8/crates/compiler/src/options.rs#L108. This would have to come the Options object in
compile_sass shown here: https://github.com/getzola/zola/blob/b5a90dba5d12ea6760c3aa18fec40f8af4d7cbc7/components/site/src/sass.rs#L21. Furthermore, this implies an option in the zola config such that we can map
alias : "actual/path". We could use that mapping to string replace the alias in the file and add those sass containing directories to the options passed to grass.
Hopefully this works well within the design goals of Zola.