Allow users to choose whether to optimize css.

Created on 9 May 2018, over 7 years ago
Updated 14 August 2023, almost 2 years ago

I am running into an issue that may be considered a bug.

If you have s3fs enabled but you did not enable the css_aggregation and the corresponding redirects necessary to make css_aggregation work with s3fs then the print will f$config->get('force_download')ail causing an error :
file_get_contents(https://example.com/s3fs-css/css/css_uw1Zc3jXzLr2tejqtnrdS4uPG5H-K56kKb9... not found.

That's because entity_print is trying to get the aggregated css file from /s3fs-css which is supposed to redirect to s3 if it's been set up to do so: https://cgit.drupalcode.org/s3fs/tree/README.txt?h=8.x-3.x#n134

However, I don't have the css_aggregation set up nor do I have it css_aggregation using s3 yet entity_print tries to do that and assumes optimize css will succeed.

Proposed Solution:
- Allow users to choose whether to optimize css.

Patch attached.

🐛 Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

🇺🇸United States awm

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • 🇬🇧United Kingdom Alina Basarabeanu

    Patch from #14 fixed the issue on Drupal Drupal Version 9.5.10 and entity_print 2.x-dev@dev.
    Currently, issue 2860122 doesn't include an option to optimize CSS.

  • Status changed to Needs work 30 days ago
  • 🇦🇺Australia jannakha Brisbane!

    thank you for your contribution.
    please provide a merge request for easier testing and review.

  • First commit to issue fork.
  • Merge request !81Created MR. → (Open) created by mrinalini9
  • 🇮🇳India mrinalini9 New Delhi

    Have created MR, please review it.

    Thanks!

  • Pipeline finished with Failed
    30 days ago
    Total: 407s
    #547523
  • 🇦🇺Australia jannakha Brisbane!

    @mrinalini9 thanks for MR
    can you please fix CI issues (phpcs etc)

  • Would the progress on this issue make it unnecessay on D10.5.1 to still change in src/PrintBuilder.php

    $print_engine->addPage($renderer->generateHtml($entities, $render, $use_default_css, TRUE));

    to

    $print_engine->addPage($renderer->generateHtml($entities, $render, $use_default_css, FALSE)); ?

    This was the solution for issue 3394857 (comment #5), but after every upgrade of entity print I still have to manually change this setting in order to get all of my commerce_invoice invoices printed with their proper formatting. My latest question in 3394857 about this issue a few weeks ago went unanswered, but maybe the problem is better addressed here?

Production build 0.71.5 2024