October 2017
Intermediate to advanced
566 pages
14h 31m
English
Assuming that you already have the CSS/JS files, libraries are defined inside a module_name.libraries.yml file in the module root folder. A simple example of a library definition inside this file would look like this:
my-library: version: 1.x css: theme: css/my_library.css: {} js: js/my_library.js: {}
At the top in the preceding example, we have the library machine name, whereas we have its definition at the bottom. We can specify a version number for our library and then add as many CSS and JS file references. The file paths are relative to the module folder this library definition is in and we can add some options between the curly braces (more advanced, but we will see an example in a moment).
Additionally, you'll note that the ...
Read now
Unlock full access