Incorrect URLs of Drupal theme CSS and JS

Created on 11 October 2022, over 1 year ago
Updated 21 March 2023, over 1 year ago

Problem/Motivation

The cl-server module implements the hook_file_url_alter and this breaks the URLs of CSS and Javascript files as it appends the Scheme and HTTP Host to the file URI.

Steps to reproduce

Assuming you have the setup for Component Development using CL Components / CL Server and Storybook-drupal-addon. You can use the example components from cl_components_examples under cl_components.

I am testing it with a Vanilla Drupal 9.4 site with Olivero theme.

1. Run Story book - npm run storybook
2. Open explorer and point to http://localhost:6006 (this should be the link with default settings)
3. The example components will load.
4. Open the network tab and you will see that all the stylesheet and javascript links from the theme (usually with name starting with css_ or js_) are not loading.
5. Click on any one of these links and you will see that the Request URL is malformed like http://localhost:8080/public://css/optimized/css_97htjIvQ15V1EfeTASftshiMIzLS36LIXVDogWwnlWQ.jljVGWN9UpDBDhlOvibVHSAxjCOZonuvT1tJeWFbkHY.css?rjjf8c

Attached files showing the effects of the fixing the files.

Proposed resolution

Update the hook_file_url_alter in cl_server module to make sure the proper file URL is created.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΉAustria pavanmalji

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024