@@ -50,12 +50,50 @@ cd some-dir
50
50
composer require drupal/devel
51
51
```
52
52
53
+ ### Adding libraries
54
+
55
+ You can manage front-end asset libraries with Composer thanks to the
56
+ [ asset-packagist repository] ( https://asset-packagist.org/ ) . Composer will detect
57
+ and install new versions of a library that meet the stated constraints.
58
+
59
+ ``` bash
60
+ composer require bower-asset/dropzone
61
+ ```
62
+
63
+ ### Custom installation paths for libraries
64
+
65
+ The installation path of a specific library can be controlled by adding it to
66
+ the ` extra.installer-paths ` configuration preceding ` web/libraries/{$name} ` .
67
+ For example, the ` chosen ` Drupal module expects the ` chosen ` library to be
68
+ located on ` web/libraries/chosen ` , but ` composer require npm-asset/chosen-js `
69
+ installs the library into ` web/libraries/chosen-js ` . The following configuration
70
+ overrides installation it into the expected directory:
71
+
72
+ ``` json
73
+ {
74
+ "extra" : {
75
+ "installer-paths" : {
76
+ "web/libraries/chosen" : [
77
+ " npm-asset/chosen-js"
78
+ ],
79
+ "web/libraries/{$name}" : [
80
+ " type:drupal-library" ,
81
+ " type:npm-asset" ,
82
+ " type:bower-asset"
83
+ ]
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ For more details, see https://asset-packagist.org/site/about
90
+
53
91
### Updating Drupal Core
54
92
55
93
This project will attempt to keep all of your Drupal Core files up-to-date; the
56
94
project [ drupal/core-composer-scaffold] ( https://github.com/drupal/core-composer-scaffold )
57
- is used to ensure that your scaffold files are updated every time ` drupal/core `
58
- is updated.
95
+ is used to ensure that your scaffold files are updated every time ` drupal/core `
96
+ is updated.
59
97
60
98
If you customize any of the "scaffolding" files (commonly ` .htaccess ` ),
61
99
you may need to merge conflicts if any of your modified files are updated in a
@@ -86,12 +124,12 @@ workarounds if a project decides to do it anyway](https://getcomposer.org/doc/fa
86
124
### Should I commit the scaffolding files?
87
125
88
126
The [ Drupal Composer Scaffold] ( https://github.com/drupal/core-composer-scaffold )
89
- plugin can download the scaffold files (like ` index.php ` , ` update.php ` etc.) to
90
- the ` web ` directory of your project. If you have not customized those files you
91
- could choose to not check them into your version control system (e.g. git).
92
- If that is the case for your project, it might be convenient to automatically
93
- run the drupal-scaffold plugin after every install or update of your project.
94
- You can achieve that by registering ` @composer drupal:scaffold ` as ` post-install `
127
+ plugin can download the scaffold files (like ` index.php ` , ` update.php ` etc.) to
128
+ the ` web ` directory of your project. If you have not customized those files you
129
+ could choose to not check them into your version control system (e.g. git).
130
+ If that is the case for your project, it might be convenient to automatically
131
+ run the drupal-scaffold plugin after every install or update of your project.
132
+ You can achieve that by registering ` @composer drupal:scaffold ` as ` post-install `
95
133
and ` post-update ` command in your ` composer.json ` :
96
134
97
135
``` json
@@ -113,7 +151,7 @@ If you need to apply patches, you can do so with the
113
151
[ composer-patches] ( https://github.com/cweagans/composer-patches ) plugin included
114
152
in this project.
115
153
116
- To add a patch to Drupal module ` foobar ` , insert the ` patches ` section in the
154
+ To add a patch to Drupal module ` foobar ` , insert the ` patches ` section in the
117
155
` extra ` section of ` composer.json ` :
118
156
119
157
``` json
@@ -134,14 +172,14 @@ when resolving dependencies:
134
172
2 . The ` config.platform ` version value in ` composer.json ` .
135
173
136
174
The purpose of ` require.php ` is to set the minimum PHP language requirements
137
- for a package. For example, the minimum version required for Drupal 10.0 is
175
+ for a package. For example, the minimum version required for Drupal 10.0 is
138
176
` 8.0.2 ` or above, which can be specified as ` >=8 ` .
139
177
140
178
The purpose of ` config.platform ` is to set the PHP language requirements for the
141
179
specific instance of the package running in the current environment. For
142
- example, while the minimum version required for Drupal 10 is ` 8.0.2 ` or above,
143
- the actual PHP version on the hosting provider could be ` 8.1.0 ` . The value of
144
- this field should provide your exact version of PHP with all 3 parts of the
180
+ example, while the minimum version required for Drupal 10 is ` 8.0.2 ` or above,
181
+ the actual PHP version on the hosting provider could be ` 8.1.0 ` . The value of
182
+ this field should provide your exact version of PHP with all 3 parts of the
145
183
version.
146
184
147
185
#### Which versions to specify in my Drupal site?
@@ -150,8 +188,8 @@ This project includes `drupal/core` which already has `require.php` added. Your
150
188
would inherit that constraint. There is no need to add ` require.php ` to your
151
189
` composer.json ` .
152
190
153
- ` config.platform ` is a platform-specific. It is recommended to specify
154
- ` config.platform ` as a _ specific version_ (e.g.` 8.1.19 ` ) constraint to ensure
191
+ ` config.platform ` is a platform-specific. It is recommended to specify
192
+ ` config.platform ` as a _ specific version_ (e.g.` 8.1.19 ` ) constraint to ensure
155
193
that only the package versions supported by your current environment are used.
156
194
157
195
``` json
0 commit comments