Closed claytron5000 closed 6 years ago
After writing this out I tried the reverse: install Mannequin in the theme, and include the shared directory from there:
custom
|__shared
| |...
|__theme1
| .mannequin.php
|__js
| main.js
And
Finder::create()
->files()
->in(__DIR__.'/../shared/html/')
...
->setGlobalJs([ '/js/main.js'])
This actually makes more sense than the other way around.
The other option would be to install Mannequin at the site root or above. This kinda feels like it breaks the "isolated environment" goal.
Hey @claytron5000 - did you get this figured out? The .mannequin.php file should live above all of the components and assets. As it stands now, the setup we're recommending is one where .mannequin.php
lives in the site root (or repo root), and reference templates and styles from your theme.
That being said, I'm not sure if you'd be able to make this work with the .mannequin.php file in the theme, then referencing CSS and JS above your current directory. Maybe something like this?
$config = MannequinConfig::create([
'docroot' => __DIR__.'/../',
]);
// This becomes relative to ../
$config->setGlobalJs([ '/shared/js/main.js']);
The docroot
property is undocumented at the moment because we're not certain it's a good idea to use yet (or how we want to recommend using it), but you could try it and see if it works for you. If it does, let us know!
Thanks Rob, I might try the docroot
property. We're still working out how Mannequin gets integrated into the project, both of these suggestions are helpful.
I have mannequin installed in a
shared
directory in my custom theme directory. I want to pull CSS and JS from a theme into Mannequin. Desired directory structure:I'm trying to do something like this:
Is there a recommended way of keeping the Mannequin install separate from the theme?