After adding support for external stylesheets the next step is to add support for Drupal root paths, in the same way that Library definitions can have a Drupal root url for CSS/JS assets.
Stylesheets that aren't external and use a '/' as the first character can be safely assumed to be Drupal root relative (this what LibraryDiscoveryParser does).
So the supported set of stylesheets paths would look like this:
ckeditor_stylesheets
- //www.external.com/stylesheet.css
- /libraries/your-library/stylesheet.css
- css/stylesheet.css
The use case for this is to include CSS assets from outside the theme directory (i.e. the libraries directory).
Comments
Comment #2
jptarantoComment #4
dpiComment #5
dpiFixing D9 compat.
Comment #6
larowlanCan we get a change notice here?
Comment #7
jibranThe code changes look good and comes with test also created change record https://www.drupal.org/node/3161831 so RTBC.
Comment #8
nod_We just need $url[0] === '/' here, the double slash is checked by the condition above.
Comment #9
jibranNice catch! addressed #8.
Comment #10
alexpottCommitted 610682e and pushed to 9.1.x. Thanks!
Comment #12
saschaeggiAwesome news, I've created a follow-up to bring the same functionality to quickedit_stylesheets => #3162637: Allow quickedit_stylesheets to refer to a Drupal root URL
Comment #13
wim leersI'm sorry that I didn't see this until now — until after commit. 🙈
This makes total sense, thanks for doing this!