@@ -9,7 +9,7 @@ dependencies with [Composer](https://getcomposer.org/).
9
9
## What does the template do?
10
10
11
11
* Drupal will be installed in the ` web ` directory.
12
- * Generated composer autoloader ` vendor/autoload.php ` is used instead of
12
+ * Generated composer autoloader ` vendor/autoload.php ` is used instead of
13
13
` web/vendor/autoload.php ` provided by Drupal core.
14
14
* Modules (packages of type ` drupal-module ` ) will be placed in ` web/modules/contrib ` directory.
15
15
* Themes (packages of type ` drupal-theme ` ) will be placed in ` web/themes/contrib ` directory.
@@ -47,12 +47,50 @@ cd some-dir
47
47
composer require drupal/devel
48
48
```
49
49
50
+ ### Adding libraries
51
+
52
+ You can manage front-end asset libraries with Composer thanks to the
53
+ [ asset-packagist repository] ( https://asset-packagist.org/ ) . Composer will detect
54
+ and install new versions of a library that meet the stated constraints.
55
+
56
+ ``` bash
57
+ composer require bower-asset/dropzone
58
+ ```
59
+
60
+ ### Custom installation paths for libraries
61
+
62
+ The installation path of a specific library can be controlled by adding it to
63
+ the ` extra.installer-paths ` configuration preceding ` web/libraries/{$name} ` .
64
+ For example, the ` chosen ` Drupal module expects the ` chosen ` library to be
65
+ located on ` web/libraries/chosen ` , but ` composer require npm-asset/chosen-js `
66
+ installs the library into ` web/libraries/chosen-js ` . The following configuration
67
+ overrides installation it into the expected directory:
68
+
69
+ ``` json
70
+ {
71
+ "extra" : {
72
+ "installer-paths" : {
73
+ "web/libraries/chosen" : [
74
+ " npm-asset/chosen-js"
75
+ ],
76
+ "web/libraries/{$name}" : [
77
+ " type:drupal-library" ,
78
+ " type:npm-asset" ,
79
+ " type:bower-asset"
80
+ ]
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ For more details, see https://asset-packagist.org/site/about
87
+
50
88
### Updating Drupal Core
51
89
52
90
This project will attempt to keep all of your Drupal Core files up-to-date; the
53
91
project [ drupal/core-composer-scaffold] ( https://github.com/drupal/core-composer-scaffold )
54
- is used to ensure that your scaffold files are updated every time ` drupal/core `
55
- is updated.
92
+ is used to ensure that your scaffold files are updated every time ` drupal/core `
93
+ is updated.
56
94
57
95
If you customize any of the "scaffolding" files (commonly ` .htaccess ` ),
58
96
you may need to merge conflicts if any of your modified files are updated in a
@@ -63,7 +101,7 @@ Follow the steps below to update your Drupal core files.
63
101
1 . Run ` composer update "drupal/core-*" --with-dependencies ` to update Drupal Core and its dependencies.
64
102
2 . Run ` git diff ` to determine if any of the scaffolding files have changed.
65
103
Review the files for any changes and restore any customizations to
66
- ` .htaccess ` or ` robots.txt ` .
104
+ ` .htaccess ` or ` robots.txt ` .
67
105
3 . Commit everything all together in a single commit, so ` web ` will remain in
68
106
sync with the ` core ` when checking out branches or running ` git bisect ` .
69
107
4 . In the event that there are non-trivial conflicts in step 2, you may wish
@@ -83,12 +121,12 @@ workarounds if a project decides to do it anyway](https://getcomposer.org/doc/fa
83
121
### Should I commit the scaffolding files?
84
122
85
123
The [ Drupal Composer Scaffold] ( https://github.com/drupal/core-composer-scaffold )
86
- plugin can download the scaffold files (like ` index.php ` , ` update.php ` etc.) to
87
- the ` web ` directory of your project. If you have not customized those files you
88
- could choose to not check them into your version control system (e.g. git).
89
- If that is the case for your project, it might be convenient to automatically
90
- run the drupal-scaffold plugin after every install or update of your project.
91
- You can achieve that by registering ` @composer drupal:scaffold ` as ` post-install `
124
+ plugin can download the scaffold files (like ` index.php ` , ` update.php ` etc.) to
125
+ the ` web ` directory of your project. If you have not customized those files you
126
+ could choose to not check them into your version control system (e.g. git).
127
+ If that is the case for your project, it might be convenient to automatically
128
+ run the drupal-scaffold plugin after every install or update of your project.
129
+ You can achieve that by registering ` @composer drupal:scaffold ` as ` post-install `
92
130
and ` post-update ` command in your ` composer.json ` :
93
131
94
132
``` json
@@ -110,7 +148,7 @@ If you need to apply patches, you can do so with the
110
148
[ composer-patches] ( https://github.com/cweagans/composer-patches ) plugin included
111
149
in this project.
112
150
113
- To add a patch to Drupal module ` foobar ` , insert the ` patches ` section in the
151
+ To add a patch to Drupal module ` foobar ` , insert the ` patches ` section in the
114
152
` extra ` section of ` composer.json ` :
115
153
116
154
``` json
@@ -137,7 +175,7 @@ for a package. For example, the minimum version required for Drupal 11.0 is
137
175
The purpose of ` config.platform ` is to set the PHP language requirements for the
138
176
specific instance of the package running in the current environment. For
139
177
example, while the minimum version required for Drupal 11 is ` 8.3 ` or above,
140
- the actual PHP version on the hosting provider could be ` 8.3.1 ` . The value of
178
+ the actual PHP version on the hosting provider could be ` 8.3.1 ` . The value of
141
179
this field should provide your exact version of PHP with all 3 parts of the
142
180
version.
143
181
0 commit comments