I'm using Roots/Bedrock for my WordPress structure and I want to use WebDevStudios/CMB2 as a library and not as a plugin.
The Roots/Bedrock composer.json specifies that dependencies of type:wordpress-plugin
be installed in app/plugins
. The WebDevStudios/CMB2 composer.json declares that it is a wordpress-plugin
type, so it gets installed into app/plugins
which is not where I want it.
How can I get this dependency to be installed into vendor
and not app/plugins
?
I have a suspicion I might have to fork CMB2 and change it's type from wordpress-plugin
to library
, but I'm hoping there is a cleaner solution.
答案 0 :(得分:0)
我没有使用Roots / Bedrock但是在添加CMB2作为插件的依赖时(而不是将其作为单独的插件加载)我遇到了类似的问题。它正在wp-content/plugins
而不是vendor
安装插件。以下对我有用。
{
"require": {
"webdevstudios/cmb2": "^2.2",
},
"autoload" : {
"files": [
"vendor/webdevstudios/cmb2/init.php"
]
},
"extra": {
"installer-paths": {
"vendor/webdevstudios/cmb2": ["webdevstudios/cmb2"]
}
}
}
关键是installer-paths
条目告诉Composer我们要安装webdevstudios/cmb2
的位置。