[V2] SASS: update compilation mechanism

Created on 10 February 2024, 5 months ago
Updated 11 February 2024, 5 months ago

Problem/Motivation

Current SASS compilation mechanism has been copied from the Gin theme when Gin Layout Builder had been created.

Currently it requires to use NodeJS 14 (or with NVM) to be able to compile CSS (JS compilation is no more needed) and old versions of SASS which prevents usage of new syntax.

Also I use core Stylelint + postcss-scss to be able to run Stylelint on SASS files and I have some rules not possible to fix because it provokes side effect with the old SASS versions currently used to compile.

app/modules/custom/gin_lb/styles/components/_details.scss
 25:52  βœ–  Expected complex :not() pseudo-class notation  selector-not-notation

app/modules/custom/gin_lb/styles/components/_form.scss
 187:27  βœ–  Expected complex :not() pseudo-class notation  selector-not-notation
 187:35  βœ–  Expected complex :not() pseudo-class notation  selector-not-notation
 187:86  βœ–  Expected complex :not() pseudo-class notation  selector-not-notation

app/modules/custom/gin_lb/styles/components/_media-library.scss
 250:22  βœ–  Expected complex :not() pseudo-class notation  selector-not-notation
 297:26  βœ–  Expected complex :not() pseudo-class notation  selector-not-notation

6 problems (6 errors, 0 warnings)

And here is the .stylelintrc.json that I used:

{
  "extends": ["./.stylelintrc.json"],
  "customSyntax": "postcss-scss",
  "rules": {
    "annotation-no-unknown": null,
    "at-rule-no-unknown": null,
    "function-no-unknown": [true, {
      "ignoreFunctions": [
        "icon",
        "map-get",
        "mix",
        "scale-color",
        "sprite-str-replace",
        "str-index",
        "str-slice"
      ]
    }],
    "no-invalid-position-at-import-rule": null
  }
}

So I guess all the ignored functions will maybe have to be updated too?

Proposed resolution

The package.json and webpack config had been updated in Gin.

Some options:

  1. Update Gin Layout Builder compilation mechanism to reflect last changes in Gin and keep Webpack
  2. Keep Webpack for the special mechanism that generates the classes.json file and use Gulp with gulp sass to compile SASS

I currently only see those 2 options as I am not very into frontend stuff and I know Gulp. I don't know Webpack and I want to simplify stuff to facilitate the contribution and maintenance of the module.

Remaining tasks

Decide of an option. to ease maintenance.

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

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

Comments & Activities

Production build 0.69.0 2024