Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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).
Comment | File | Size | Author |
---|---|---|---|
#9 | 3099662-9.patch | 3.05 KB | jibran |
Comments
Comment #2
jptaranto CreditAttribution: jptaranto at PreviousNext commentedComment #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!