File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -114,3 +114,25 @@ section of composer.json:
114114 }
115115}
116116```
117+
118+ ### How can I add js/css libraries using composer.json?
119+
120+ It is possible to use frontend libraries with composer thanks to the
121+ asset-packagist repository (https://asset-packagist.org/ ).
122+
123+ For example, to use colorbox:
124+ ```
125+ composer require npm-asset/colorbox:"^0.4"
126+
127+ ```
128+ Composer will detect new versions of the library that meet your constraints.
129+ In the above example it will download anything from 0.4.* series of colorbox.
130+
131+ When managing libraries with composer this way, you may not want to add it to
132+ version control. In that case, add specific directories to the .gitignore file.
133+ ```
134+ # Specific libraries (which we manage with composer)
135+ web/libraries/colorbox
136+ ```
137+
138+ For more details, see https://asset-packagist.org/site/about
Original file line number Diff line number Diff line change 1717 "commerce_base" : {
1818 "type" : " vcs" ,
1919 "url" : " https://github.com/drupalcommerce/commerce_base"
20+ },
21+ "asset-packagist" : {
22+ "type" : " composer" ,
23+ "url" : " https://asset-packagist.org"
2024 }
2125 },
2226 "config" : {
3640 "drupal/swiftmailer" : " ~1.0" ,
3741 "drupal/token" : " ~1.0" ,
3842 "drupalcommerce/commerce_base" : " dev-8.x-1.x" ,
43+ "oomphinc/composer-installers-extender" : " ^1.1" ,
3944 "webflo/drupal-finder" : " ^1.0" ,
4045 "webmozart/path-util" : " ^2.3"
4146 },
7479 ]
7580 },
7681 "extra" : {
82+ "installer-types" : [
83+ " bower-asset" ,
84+ " npm-asset"
85+ ],
7786 "installer-paths" : {
7887 "web/core" : [
7988 " type:drupal-core"
8089 ],
8190 "web/libraries/{$name}" : [
82- " type:drupal-library"
91+ " type:drupal-library" ,
92+ " type:bower-asset" ,
93+ " type:npm-asset"
8394 ],
8495 "web/modules/contrib/{$name}" : [
8596 " type:drupal-module"
You can’t perform that action at this time.
0 commit comments