Hi all,
I want to serve a set of optimized images from my child_theme, as a response to the requests in the parent_theme
To do that i’ve created the following file (under trellis/nginx-includes/all
)
── nginx-includes
│ └── all
│ └── rewrites.conf.j2
The file contain this…
location ~* ^/app/themes/perfetta/images/(.*) {
rewrite ^/app/themes/perfetta/images/(.*) /app/themes/_lasrecetasdeguada/images/$1 last;
}
I’m not 100% sure if this is correct, but i’m trying different approaches and none of them seem to work. The idea is to capture all requests to the folder images in the parent theme (perfetta
) and instead of those files, serve the ones at my child theme (_lasrecetasdeguada
) => these images in my child theme are compressed and optimized
After this i’m doing vagrant provision
and evertyhing goes ok with the provision.
If i check the virtual machine (with vagrant ssh
) i can verify that te proper files are being created in the proper location
── etc
│ └── nginx
│ └── includes.d
│ └── all
│ └── rewrites.conf
But when i request http://lasrecetasdeguada.test/app/themes/perfetta/images/bg-desktop.jpg
(domain part of multisite)
or
http://juanmaguitar.test/app/themes/perfetta/images/bg-desktop.jpg
(path with main domain of multisite), the original file (the one in the parent theme) is served instead of the one in the child theme
Any idea? I haven’t seen this solution anywhere but i think it could be a good solution to serve optimized assets (images, css, js) of plugins or themes from our child_themes
Thanks in advance!!!
- JuanMa
Note: I’m trying this in my local multisite installation. Being juanmaguitar.test
the main domain and lasrecetasdeguada.test
the domain of one of the sites