Legacy Knowledge Base
Published Jul. 2, 2025

CSS minifier skips translating relative urls for already minified files

Written By

Alfonso Crisci

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

Issue

  • Combo servlet bundles/aggregates multiple CSS files into single downloads. Some of those CSS files might already have been minified, so those are not minified again.

    Apart from bundling multiple files, the Combo servlet also translates relative URLs used in CSS files so that they still work even though the location of the CSS file is now different (/combo?.... instead of /o/my-portlet/css/)

    The issue is: if an already minified CSS file contains a relative URL, this relative URL is not translated (because the file is skipped completely).

  • See LPS-128528 for a test-case and reproduction steps.

Environment

  • Liferay DXP 7.0+

Resolution

  • To work the issue around, please use extensions for CSS files that are different from -min.css or .min.css

Additional Information

  • Based on ComboServlet.java, particularly this snippet:

    if (!StringUtil.endsWith(resourcePath, _CSS_MINIFIED_DASH_SUFFIX) &&
    !StringUtil.endsWith(resourcePath, _CSS_MINIFIED_DOT_SUFFIX) &&
    !StringUtil.endsWith(
    resourcePath, _JAVASCRIPT_MINIFIED_DASH_SUFFIX) &&
    !StringUtil.endsWith(
    resourcePath, _JAVASCRIPT_MINIFIED_DOT_SUFFIX))
    The behavior is expected.

 

Did this article resolve your issue ?

Legacy Knowledge Base