SDC components CSS & JS generated wrong url in windows / XAMPP

Created on 19 June 2023, about 1 year ago
Updated 18 June 2024, 8 days ago

Problem/Motivation

I create some SDC components, when using theme, the js and CSS file not load correctly.
I got error in chrome console. this is the url generated by SDC:

/yiysites/core/modules/sdc/../modules%5Ccontrib%5Cblocktabs_jquery_ui%5Ccomponents%5Ctabs-default%5Ctabs-default.js?rwh76n

it should be:

/yiysites/modules/contrib/blocktabs_jquery_ui/components/tabs-default/tabs-default.js?rwh76n

Steps to reproduce

1, using a win10 OS.
2, install xampp, XAMPP is the most popular PHP development environment, https://www.apachefriends.org/index.html
3, create a site in sub directory of htdocs
4, install SDC module
5, create a component in custom module.

Proposed resolution

Windows using a different file path compare linux, it use "\\" instead of "/". we need add some logic code for windows condition.
here is some dirty code that I fixed it quickly in makePathRelativeToLibraryRoot of \Drupal\sdc\ComponentPluginManager :

	  $path_from_root=str_replace('\\','/',$path_from_root); 
    //return $dots . $path_from_root;
	$path_from_root= "/" .  $path_from_root;
	return $path_from_root;

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
single-directory componentsΒ  β†’

Last updated about 21 hours ago

Created by

πŸ‡¨πŸ‡³China g089h515r806

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