folbert / fewbricks

Write code to create ACF field groups, fields and re-usable modules.
https://fewbricks2.folbert.com
GNU General Public License v3.0
124 stars 12 forks source link

Composer support for Bricks and Layouts #4

Closed folbert closed 8 years ago

folbert commented 8 years ago

Copied question by @christianmagill from issue nr 1 to avoid mixing issues.

_ Would it be possible to add Composer support for Bricks and Layouts as well? It would be cool to be able to choose in composer which items you need for your particular project.

folbert commented 8 years ago

If I understand your suggestion correctly (and please let me know if I don't), my answer is this:

Bricks is an integral part of Fewbricks which it would make no sense not to include. And if you don't want to use layouts, you don't have to do anything besides not using it. You can even delete the layouts folder if you want.

Because of the above, adding those two as separate packages would only add a layer of complexity with no benefits.

christianmagill commented 8 years ago

I'm talking about the ones we create custom. So if you had a collection of custom bricks and fields you could import the ones you need for a project. Instead of needing to place them in the "theme/fewbricks/bricks" folder, etc.

folbert commented 8 years ago

So f I understand you correctly now, you want the directory that holds the directories "bricks", "layouts" etc. to go inside its own folder in plugins or in the Composers vendor directory?

Thanks for the suggestion. However, my experience is that even if you do have a collection of commonly used bricks and layouts, you will probably want to modify them for each site that you build. That is especially true if you put the CSS file alongside each brick file. Having a Composer module would overwrite your local modifications everytime the Composer repo is updated, would it not?

That being said, you could set up your own Composer repo based on the folder fewbricks/fewbricks. And then you can create a symlink from themes/[your-theme]/fewbricks that points to the downloaded Composer repo.

The way Fewbricks is built, reusing a brick from one project to another is simply a matter of copying the bricks file and any related css file and paste it into your new project. It's maybe not as high tech as having it pulled in using Composer but I feel that it's the smartest and easiest way to do it.