Open justinmetros opened 5 years ago
Update: Ugly fork here that breaks all tests, but otherwise seems to work?
Looks like it should accept any .liquid file in a folder and rename it to folderName.liquid.
i.e.
/src/sections/header/foo.liquid
-> /dist/sections/header.liquid
To get locales to work the filename needs to match the folder name: /src/sections/header/header.liquid
-> /dist/sections/header.liquid
This is a horrible mess I made here but it is keeping my editor nice and easy to navigate. Needs error checking and tests.
If anyone thinks this is a good idea, could probably clean it up and make some tests for a PR.
Also, maybe this all goes out the window if we start to do nested folders? Anyways, thanks in advance! Appreciate all your work on Slate :)
Edit: A few other benefits with this I noticed - finding files is A LOT easier ( using VSCode at least ). Also started putting the sectionName.js
files in the sections folder so its all together and the .liquid and .js files are named the same. This feels like a better pattern than putting js in scripts/sections
because its all together and just import it in the relevant template files.
Problem
Feature Request: When using the new Sections Plugin w/ folder structure ( very cool to be able to get syntax highlighting on the JSON ) - you end up with a ton of files named template.liquid which makes using them in an editor a little confusing. All the tabs are named template.liquid.
If would be cool if you could specify a wildcard for
this.options.genericTemplateName
so that it looks for a liquid file the same as its folder.Maybe something like:
or
So instead of:
sections/header/template.liquid
we could do
sections/header/header.liquid
This would make using this folder structure on larger projects a bit easier to reason about with lots of files open in an editor.
Replication steps
None. Its currently behaving as outlined in docs.
More Information
I see this is tied to locales so when I tried to get this working I broke that. If I can find some time will try to put together a pull request with proper tests. But if any experts have a hotfix I could use on this specific project, thats awesome. Thanks, and great work on this!