Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [libraries]

Use it for questions about using third-party libraries with Drupal, or the Libraries API module.

0
votes
0answers
5 views

Dynamically remove library based on user role, cache context not working

I want to remove all libraries of modules & themes, except those from modules/themes that are defined by me. This should only be done for anonymous users. All libraries should be served to ...
0
votes
1answer
21 views

Adding core Javascript libraries in my_module.libraries.yml

I've read Adding stylesheets (CSS) and JavaScript (JS) to a Drupal 8 module and I can see where you can add assets that are part of your module or from a CDN or external source. What about if that ...
1
vote
1answer
37 views

How do I get the requirements in a module's composer.json merged into the consolidated composer.json?

I am trying to use composer correctly to install a library named nikic/php-parser. Thanks to helpful comments by Clive, I now understand that when a Drupal 7 module comes with a composer.json file, ...
0
votes
0answers
16 views

How does drupal recognize the external js library imageflow with the libraries module?

I want to upgrade the imageflow module to drupal 8. Therefore I created a module "myimageflow". "myimageflow.libraries.yml" seems to be ok according to function myimageflow_library_status(), but ...
0
votes
2answers
42 views

Exclude a JavaScript file from a node

I'd like to exclude a js file from loading on to a specific node. Right now my libraries.yml file looks like this: global-styling: version: 1.x css: theme: css/bootstrap/bootstrap.css: ...
0
votes
1answer
26 views

PHP namespace error

I'm using libraries, not using composer, and it's on Drupal 7. I installed and enabled xautoload so that I can use classes from a library that has namespacing. I think I got the xautoload function of ...
0
votes
1answer
52 views

How to add print stylesheets

How do I add a print stylesheet in Drupal 8? Here is what my libraries file looks like in my theme... global-styling: version: 8.0 css: base: css/style.css: {} theme: css/...
1
vote
1answer
48 views

How many libraries is too much before there is a performance issue? [closed]

We are using Paragraphs module to allow for selecting of up to 15 different Paragraph Types. As part of this, each one requires its own CSS and JS since they are vastly different. We already have a ...
0
votes
1answer
27 views

Where do I place helper files? [duplicate]

I would like to place some (PHP)functions in a helper files, which requires across modules and themes. Do I have to create a new module or I can place a simple helper file with list of common ...
0
votes
1answer
33 views

How to use libraries function

I have the libraries module to add some libraries in my drupal site. Currently I need to use mailjet, I found some modules with some functions to talk with api but I've tested this for multiple hours ...
-2
votes
1answer
53 views

Ensure specific JS files always load last? [closed]

(I have looked at related answers, they provide no help because they make invalid assumptions.) I'm working on a job where the front-end is component-based. I have no control over this. Some of the ...
1
vote
1answer
133 views

Why is my theme library load on every page?

I'm beginning with D8, but I work a lot with D7 and Magento. I follow the developer documentation to add a library in my theme, and I don't understand why it's loading it on every page. I only want ...
1
vote
1answer
36 views

How to inculde 3d parrty libraries into your module?

I am using the 3d party php library, and I do not know how to connect. The file structure of my project looks like following: -my_project --src ---Plugin ----Action -----MyAction.php ---libs ----...
0
votes
1answer
26 views

Loading a custom library after all other libraries got loaded

So i wan't to load a custom .js file at the very end of the page after all other .js files have been loaded. This is my library file: my_library: js: assets/js/custom.js: {} dependencies: ...
1
vote
0answers
31 views

Adding an Attribute to a Script Tag Before Src

I'm working with CloudFlare and have identified a script that needs the data-cfasync=“false” attribute applied so CF doesn't touch it. This script is defined in a library in a custom module. my-...
1
vote
2answers
125 views

drupalSettings object not showing for anonymous users. core/drupalSettings is added as a library dependency

I'm stumped on this one. I’m having an issue where the drupalSettings object is empty when not logged in. Works fine when I am authenticated. - core/drupalSettings is in theme’s *.libraries.yml file. ...
-1
votes
1answer
23 views

Load module config into Javascript from a different module

I have two Drupal modules. One is a shared module that provides a JavaScript library. The second is a module that builds a form which uses that library. Lets call them modlib and modform. They've ...
1
vote
2answers
468 views

How to use Composer to install third party libraries [duplicate]

All I thought Composer takes care of any external library a contrib module requires automatically. I tried installing one, Composer took care of all its dependency modules, but not so much with the ...
1
vote
0answers
48 views

Unable to attach third-party library to theme

I have a multi value media field on a content type and I want to display it as a slider on the node if more than one image is uploaded to that media field.I am using slick library for this purpose. ...
1
vote
2answers
48 views

Load library dynamically depending on settings

My theme has a few settings that can be adjusted, one of them is style. I want to load the libraries depending on the styles, but without writing them in the .libraries.yml function ...
0
votes
1answer
44 views

How do I load a library using xautoload and libraries?

I am trying to load the facebook SDK (drupal 7) but I am getting the error Error: Class 'Facebook\Facebook' not found in FbPageSyncProcessSubmission::fbpagesync_facebook_sdk_initialize() ( My ...
1
vote
1answer
66 views

Local vs CDN libraries and how to check for available updates

For contributed Drupal modules, you can check whether you are using the latest version release of the module or not, by using any of the available methods such as Drush, Drupal console, Composer and ...
0
votes
1answer
75 views

How to add css files based on breakpoint in library?

We have the following mytheme.breakpoints.yml file and a simple library mylibrary that is added through our mytheme. Within the mylibrary there are two libraries, one that is optimized for desktop ...
0
votes
1answer
164 views

How to load a library only once, or how to check if a library has been loaded?

I am making an asynchronous single page application in Drupal 8. So far everything is working nicely. However, it has a lot of libraries that are needed for a lot of different things, depending on ...
0
votes
0answers
10 views

What are the expected aggregated css files when there is a dependency?

We have the following setup for two libraries: mylibrary1 and mylibrary2. Additionally we have Aggregate CSS Files = true under /admin/config/development/performance. Due to Aggregate CSS Files ...
1
vote
1answer
93 views

Module Library JS Some In Header Some In Footer

I have read that Drupal 8 by default loads library-defined files into the footer. My module libraries.yml file makes use of the "header: true" property as several JS files are needed to load in the ...
0
votes
1answer
56 views

How do I load CSS files to a custom theme?

I understand this question has been asked many times. However, I still can't figure out why the CSS files of my custom Drupal 8 theme are not loading. Edited (more info): The CSS files are not being ...
3
votes
1answer
80 views

Can you override a library per environment?

In my libraries.yml file, I have something like this, being used to define "foo-bar" as a library that can be pulled in from various parts of the site: foo-bar: version: 0.0.x js: js/foo-dev....
0
votes
2answers
52 views

How to prevent dynamic library definition from being cached?

I have a use case where i want to dynamic add library , Attributes of library will vary with page. In my case the $callback will be different depending on the page. $libraries['sample.my-lib'] = [ ...
1
vote
1answer
122 views

How to load library only on one twig template?

We have a custom theme, mytheme where we have the following library for the header-fix. I have also added {{ attach_library('mytheme/header-fix') }} to only one twig template block--myblock.html.twig ...
1
vote
1answer
19 views

jQuery transition not run on anon page

I am running Drupal 8.5.5 and am running into a problem. It seems for anonymous users jQuery is not loading a library that it would when I am logged in as admin. I tried to understand why that is but ...
1
vote
0answers
73 views

How do I get the list of all CSS files?

I'm trying to understand how I can have the whole list of the CSS, JavaScript, and the others files declared with the libraries method (or added in any right way to Drupal). Earth would be a better ...
1
vote
1answer
116 views

How to load JS as the first item in head tag?

We have a custom module that has a JS library that we want to load in the <head> tag as the very first item even before all the normal Drupal JS files. All other libraries are loaded through ...
0
votes
1answer
99 views

Why is jQuery dependency not working?

I'm extending core Classy theme so I have included my JavaScript code in theme.libraries.yml file like this: js: js/blogger-list.js: {} dependencies: - core/jquery but still browser console ...
0
votes
1answer
92 views

Changing library path with hook_library_info_alter

I am having difficulties to change the library path defined by another module in *.libraries.yml via hook_library_info_alter Essentially I have one module defining a library component in its *....
0
votes
1answer
84 views

Unable to install the “H5P.Scorm.h5p” library: “The uploaded file was not a valid h5p package”

Thanks to jackrabbithanna’s help on this other question I seem to be 1/2 way to getting H5P related libraries installed in my Drupal 7.59 install. I am attempting this on macOS High Sierra under MAMP ...
2
votes
1answer
159 views

How can I install H5P SCORM libraries?

The subject says it all. I am attempting to install H5P SCORM libraries in an install of Drupal 7.59 and running into a roadblock: None of what I am reading—or understanding—is clear about how to ...
1
vote
1answer
87 views

Installing the Waypoints plugin

I’m using Drupal 8.5.4 and I have installed the Advanced CSS/JS Aggregation module. I’m trying to install the Waypoints plugin without success via the module: jQuery waypoints (still on alpha1 for D8)....
1
vote
1answer
262 views

How do you disable the CSS from a core module in Drupal 8 using libraries-override?

I'm trying to disable the CSS styles from the layout discovery module in my theme.info.yml file. I've tried several options, but I can't seem to get it to work. This is what I have now. libraries-...
1
vote
1answer
563 views

How to make CSS and JS both load in the footer

We have a library slick_carousel in our mytheme.info.yml and mytheme.libraries.yml defined in our sub-theme (see below). How can we make the CSS and JS both load in the footer? Currently only the JS ...
0
votes
1answer
561 views

Attach custom css library to entity print output

I need to attach custom css library so entity_print module uses it to generate the final PDF. The goal is to get custom css effect the generated PDF at /print/pdf/node/{{NID}} I have set the PDF ...
0
votes
0answers
378 views

How to install wkhtmltopdf Libraries?

Drupal 7.59 I use Views extensively, and would like to add https://www.drupal.org/project/views_data_export_pdf module. As per the Module documentation, a prerequisite is the installation of ...
2
votes
1answer
245 views

How to attach a library to a page controller that returns a plain Symfony response?

I created a custom module with a page controller that returns a Symfony response (Symfony\Component\HttpFoundation\Response). The thing is I don't want to render my custom theme in this controller, ...
3
votes
1answer
160 views

Common Custom PHP Library: Drupal 8 and Stand-alone Shell Scripts

I have a Drupal 8 custom module that contains 5K of php in 10 classes. This code is production ready for the launch of a new website. I also have code that runs from non-drush shell scripts. One ...
0
votes
0answers
175 views

Modules cannot find vendor libraries

I am developing Drupal 8 with Commerce. I need to have UPS and Fedex shipping modules and I noticed a strange problem with vendor dependencies. I use a remote server to run the site and use Netbeans ...
4
votes
3answers
946 views

How do I include a CSS library in my custom module?

I want to include the YAMM!3 CSS library in my Drupal 8 site. To that end, I wrote a custom module following the instructions in this answer. Although that answer is in regards to a php library, I ...
1
vote
1answer
313 views

Chosen library not working

I installed chosen module and the library v1.8.3. Jquery update is 1.10 Libraries is installed and enabled as well. I get this error on the console when I try to use a select list with chosen: ...
0
votes
1answer
79 views

correct way to load JS library for custom module

I am trying to use d3.js in my module, but I am facing some issues. I have the D3 module installed in sites/all/modules/d3/ and d3.min.js installed in sites/all/libraries/d3/, and I can see the d3/...
0
votes
2answers
91 views

Drupal 8 include Third Party Library

Hi I have a third party library located in the root/librariesbut it is not called on my webpage. I was wondering using my subtheme/subtheme.theme or subtheme.libraries.yml I call it from here? Any ...
1
vote
1answer
357 views

From my child theme, how can I remove a library loaded by the parent theme?

I have hit an issue which I think is quite unusual or peculiar when settingup a child theme. A commercial parent theme I have bought loads the Slick library like this in its theme.libraries.yml: ...