Problem / Motivation
In order to use css/js into Drupal is via the libraries (*libraries.yml). We need to be able to support generating libraries to our themes and modules.
Solution
- We need to be able to generate a new library with versions and multiples external files and internal files.
- We need to generate some of the css/js even thought they are empty.
- CSS new files generation should be structure somehow in the SMACSS standards, or at least ask question to the user leading into have a css structure instead of one big css.
- This should be modular enough that it can be use on modules and themes.
Here is an example of an external library in the libraries file.
core/core.libraries.yml
backbone:
remote: https://github.com/jashkenas/backbone
version: "1.2.3"
license:
name: MIT
url: https://github.com/jashkenas/backbone/blob/1.2.3/LICENSE
gpl-compatible: true
js:
assets/vendor/backbone/backbone-min.js: { weight: -19, minified: true }
dependencies:
- core/underscore
Here is an example of a library on a theme using local files.
light_skeleton.libraries.yml
skeleton:
version: 2
js:
assets/js/light_skeleton.js: {}
dependencies:
- core/jquery
css:
theme:
vendor/skeleton/css/skeleton.css: {}
vendor/skeleton/css/style.css: {}
assets/css/light_skeleton.css: {}
For more information about Drupal 8 Libraries (assets) - https://www.drupal.org/developing/api/8/assets
Problem / Motivation
In order to use css/js into Drupal is via the libraries (*libraries.yml). We need to be able to support generating libraries to our themes and modules.
Solution
Here is an example of an external library in the libraries file.
core/core.libraries.yml
Here is an example of a library on a theme using local files.
light_skeleton.libraries.yml
For more information about Drupal 8 Libraries (assets) - https://www.drupal.org/developing/api/8/assets