SDC is loading Post CSS files, not just compiled CSS files

Created on 8 June 2023, over 1 year ago
Updated 9 June 2023, over 1 year ago

Problem/Motivation

If you have a PostCSS file in your component it will be loaded as it was a compiled css.

Steps to reproduce

On any component add a PostCSS file, for instance my-component.pcss.css and add some styles inside it.
Clear cache and reload the page using the component and the styles inside the PostCSS file will be loaded.

Proposed resolution

Ignore *.pcss.css and any other files that aren't just *.css

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

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

Comments & Activities

  • Issue created by @javi-er
  • 🇬🇷Greece TheodorosPloumis Greece

    This is a good suggestion.

    But if you want to disallow the component using the postcss files add them in a subfolder inside the component and manage the compiling accordingly. Example:

    /my-component/
    - my-component.css
    - my-component.twig
    - my-component.yml
    /pcss
    - my-postcss-component.css

  • @TheodorosPloumis if you do that, the CSS file will be generated inside your /pscss folder (see core/scripts/css/postcss-build.js) and it will not be loaded by SDC, so in that case core assets compilation will need to be adjusted specifically for SDC. In any case, I think it's still a mistake that it loads anything that ends with .css as if it was a stylesheet, and it will probably prevent future problems to adjust this module for taking in account these cases.

  • Status changed to Closed: works as designed over 1 year ago
Production build 0.71.5 2024