Use absolute paths in css

Created on 30 August 2018, about 6 years ago
Updated 11 May 2023, over 1 year ago

Problem/Motivation

Add the option to Use absolute paths to CSS files, so wkhtmltopdf includes them.

Proposed resolution

Add a new setting.

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

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.

  • 🇺🇸United States caesius

    Reroll last patch on latest dev

  • Status changed to Needs work over 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
    1. +++ b/src/Asset/AssetRenderer.php
      @@ -41,17 +49,20 @@ class AssetRenderer implements AssetRendererInterface {
      +  public function __construct(AssetResolverInterface $asset_resolver, AssetCollectionRendererInterface $css_renderer, AssetCollectorInterface $asset_collector, FileSystem $file_system) {
      

      let's default this to null and trigger a deprecation if its not set

      see https://git.drupalcode.org/project/drupal/-/blob/10.1.x/core/lib/Drupal/... for an example

      we also need a change notice (link to add one is above) so we can link to it from the deprecation error

    2. +++ b/src/Asset/AssetRenderer.php
      @@ -73,6 +84,15 @@ class AssetRenderer implements AssetRendererInterface {
      +        $asset['type'] = 'external';
      +
      +        // The file should be used at filesystem level, so add 'file://'.
      +        $asset['data'] = 'file://' . $this->fileSystem->realpath($asset['data']);
      

      As per review above from benjy, these might not be a file, could be inline css

    3. We need a post update hook to set the default value in the config
  • 🇮🇹Italy robertoperuzzo 🇮🇹 Tezze sul Brenta, VI

    Patch #11 also needs some work to be compatible with S3 File System . I'm getting this error

    Drupal\entity_print\Asset\AssetRenderer::__construct(): Argument #4 ($file_system) must be of type Drupal\Core\File\FileSystem, Drupal\s3fs\S3fsFileService given, called in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259
    
  • 🇦🇹Austria nimoatwoodway Tyrol / Austria

    After upgrading Drupal from 8 to 10 and upgrading this module, CSS was broken. I use now this patch instead of this here: https://www.drupal.org/project/entity_print/issues/2971822#comment-13884693 🐛 Allow users to choose whether to optimize css. RTBC which fixes the problem for me using wkhtmltopdf.

Production build 0.71.5 2024