-
Notifications
You must be signed in to change notification settings - Fork 365
Allow for subdirectories in snippets/
and sections/
#781
base: master
Are you sure you want to change the base?
Conversation
Should this be able to work like |
my preference would be for |
My hope is that we can eventually reference snippets and sections with relative paths like:
And then on build replace the path with resolved path:
This would allow us to resolve naming conflicts internally and never let the developer worry about them. For example, if we had these two includes:
they would be resolved to the following on build:
Thoughts? This PR is moving in that direction, so I'm not opposed to the solution proposed here for now. |
tbh, i'm not really that attached to this pull request since everything that it does and that I want it to do can be accomplished from within Then, when a developer starts building a new theme, they get all the core snippets and can use them to build out their store, but if they need a component that differs wildly from the version that core snippet component offer, they would made a snippet with the exact same name in a different directory (e.g. Like I mentioned, I can get all of this already with a few modifications to my |
Going to let this one brew for a little since it's not critical and as you mentioned, it can be achieved via the Slate config.
What's the advantage of this over just modifying the original? What you're proposing sounds like Wordpress child themes, which existed to facilitate versioning the core/parent theme. Shopify themes don't really have anything similar to this, nor does Slate?
True. Thanks for clarifying further your goal with this PR. |
@t-kelly i'm with you in that i definitely feel you should be using some sort of patch to include things as opposed to magic resolving. Only think i'd potentially change is instead of {% include 'hero' %}
{% include 'hero2' %} It would be something like: {% include 'hero' %}
{% include 'collectionshero' %} I see "built" liquid files as slightly different to built CSS / JS. They can still somewhat be used to read and don't get obscured as much as JS / CSS so keeping it semi readable would be good imo |
My main motivation here was to give devs in our organization a set of building blocks written in a way that prevents from making errors and comes prebuilt with functionality already baked in. The moment people start altering the core snippet library, bad things are liable to happen. Versioning the core snippets with something like a submodule was something I was also interested in as well. However, after reading you inputs and thinking about it, I might pivot on this a bit. Anyways, as has been mentioned a few times before, I can get what I want without this PR so feel free to do whatever you'd like with it. Merge it, close it, ridicule it, worship it, whatever, I won't lose any sleep over it. |
Sounds a little like #336 |
What are you trying to accomplish with this PR?
Allow for subdirectories to be used in the
snippets/
andsections/
directories by updating thecore.js
webpack config inslate-tools
to use a separate a file-loader rule when dealing with these two directories.The resolution order for how namespace collisions are handled is done alphabetically by directory name (with the last directory winning), and from topmost directory to bottom (with the topmost directory winning). For example:
sections/test.liquid
beatssections/aaa/test.liquid
sections/zzz/test.liquid
beatssections/aaa/test.liquid
sections/zzz/zzz/test.liquid
beatssections/zzz/aaa/test.liquid
sections/zzz/test.liquid
beatssections/zzz/zzz/test.liquid
Please provide a link to the associated GitHub issue.
#289
Checklist
For contributors:
For maintainers: