T
T
thehighhomie2018-03-21 11:03:40
WordPress
thehighhomie, 2018-03-21 11:03:40

Wordpress & Composer: Installing Carbon Fields correctly?

Almost figured out the new development trend on WP. I set up my build with Composer and everything makes me happy, except for the Carbon Fields plugin. After reading the documentation for off. site on this plugin I was delighted with it!
The only problem in the installation, namely:
I have a project structure similar to Bedrock , and when installing Carbon FIelds 2.2.0 in standard mode in the vendor folder, which is in the root, there is a problem with assets (css, js), since they are one level above the site.
The docs have a page called Support for Bedrock & similar frameworks, but I'm a little confused, if I specify the installation path to the web folder (as in Bedrock), then another vendor folder with Carbon Fields will appear in the web pack, but this will not work anyway, you can see why here .
That is, assets work fine if the plugin works if it is in the content folder, or in the plugins folder, or in the WordPress folder. But still, you can make it work from any other directory, just not higher than the site level (in the case of Bedrock, this is the web folder) by defining a constant:

define('Carbon_Fields\URL', home_url() . '/vendor/htmlburger/carbon-fields');

This crutch doesn't suit me either.
It will work if you specify the installation path to the content folder, in the case of Bedrock this is the app folder, where the themes, plugins .... folders are located + the vendor folder will be added to these folders, in which the Carbon Fields plugin will be located. Now everything works, everything is cool, but I'm confused by the fact that it looks like a crutch and the feeling is that it's not very beautiful or something when there is a common vendor folder in the root and another vendor folder (in which there is only one plugin), among folders themes, plugins...
Advise how to be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vorotnev, 2018-03-22
@thehighhomie

Set up your build with Composer

Since this is the case, look at mine too :)
As for the paths - alas, this is how they implemented it. Option with a constant IMHO the most optimal. Either is where it should be - in the /vendor/ folder, and the URL to the resources is overridden by a constant.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question