Sunsetting SCSS
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- css, php, scss
- Área
- build-system, frontend
Línea de trabajo
This issue is part of the broader style system overhaul in #6028. Read that initiative alongside this comparison of SCSS and native CSS, then map where SCSS compilation, variables, and generated stylesheets are used in the project. Done means the style system no longer depends on SCSS and supports the CSS delivery and development workflows described here.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Note: This is part of a larger initiative to overhaul the style system and the customization options in general. See #6028 to learn more.
CSS for the longest time was very static and most features focused on achieving new visual effects and layout options, with little to no progress towards the developer experience. CSS preprocessors like LESS or SASS/SCSS filled the gap by providing a single build step that provided a lot of features that ease the day-to-day work with large style codebases. However, CSS continued to evolve and provides a lot of native solutions for these problems today.
Comparison of CSS to Preprocessors Today
The following will use SCSS as the example and focused on the features currently used in our scenario.
| Feature | SCSS | Native CSS | Comment |
|---|---|---|---|
| Selector Nesting | ✅ | ✅ (Baseline 2023) | Nesting selectors allowed to extend an existing selector without having to repeat the entire selector. Over time styles became more focused and component scoped, greatly reducing the need for this feature in the first place. |
| Dynamic Variables | ❌ | ✅ (Baseline) | SCSS variables are replaced on compile time while CSS variables can change their value dynamically, for example, to change formatting based on the color scheme. |
| Functions | ✅ | ❌ | SCSS functions allow to generate CSS based on parameters. Can be emulated to some degree with CSS variables and by manually creating the selectors. |
| Extending Selectors | ✅ | ❌ | Existing selectors can be extended in SCSS which applies the same CSS rules without having to change the CSS classes in the DOM. Used only occasionally and can be replaced by proper CSS classes in the DOM instead. |
| Deriving Values | ✅ | ✅ (Baseline 2024) | Computing colors based on rules, for example, adding transparency to an existing color value. High potential for misuse by using effectively fixed values (like darken()) that fall apart for dark colors. |
| Variables for Media Queries | ✅ | ❌ | It is currently not possible to replicate helper functions like @include screen-md-down in pure CSS without processing the CSS first. This means authors will have to manually copy the selector instead of using a handful of easily memorizable helpers. There is a draft for supporting this through env() but this might still be years away. |
| ACP Options to Toggle Behavior | ✅ | ✅ | Certain options are exposed to the SCSS compiler as variables which allow for some degree of decision making when generating the CSS output. This can possibly be replicated by exporting these values as data attributes on the document/body element. |
| Auto-prefixing of selectors | ✅ | ❌ | Replacement functions in SCSS allow to write standards-compliant CSS by automagically expanding it to vendor specific selectors. Historically this was a great feature but considering the ongoing “Baseline” initiative among all major browsers, this is a thing of the past. |
| Bundling of CSS files | ✅ | ❌ | This can be achieved with very little code on our own and will be required for production. Being able to minify the CSS is nice but it’s unclear if it provides any meaningful advantage after gzip. |
| Swap out files for development | ❌ | ✅ | CSS files can simply be swapped out on-the-fly for development purposes by loading all CSS files “the traditional way”. SCSS requires an extra compilation step to yield the updated CSS. |
| On-demand stylesheets | ❌ | ✅ | SCSS compiles into one big blob, although it should be possible to create separate artifacts. CSS natively is modularized, allowing extra stylesheets to be conditionally included because there are no actual dependencies. Allows for a smaller base stylesheet. |
Other Things to Consider
We’re currently using the legacy rgba(r, g, b, a) syntax to store color values. This works just fine but requires an extra step to allow for dynamic changes, for example, to create a gradient from a color value to its transparent variant (thanks Safari!). For this purpose we’re currently outputting an extra set of variables which only contain the r g b portion of the value.
We should investigate which format is best suited to work with CSS functions, including but not limited to different color formats in general.
Path Forward
Dropping the CSS preprocessors removes quite a large library from our dependencies which is also very computational expensive. Furthermore SCSS encourages certain patterns like derived values, nesting and extending of selectors that could be considered harmful.
CSS has matured so much over the past years, that it provides most building blocks for proper development out-of-the-box in every major browser. Most important, this allows us to finally ship with on-demand stylesheets and a development mode with support for swapping out CSS files on the go, for example, by simply uploading it to a server.
The lack of variables for media queries is quite annoying because the @include screen-* have proven to be easily memorizable as well as guaranteeing a consistent behavior. However, this is just a minor nuisance that does not justify the use of a heavy preprocessor.
- Lenguaje dominante
- PHP
- Estrellas
- 248
- Forks
- 147
- Merge medio
- 17 min
- PR fusionados (30 d)
- 21
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de WoltLab/WCF
-
Problems with button inputSuffixAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Breadcrumb colors are confusingAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 58/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 30/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
WoltLab/WCF#6771 · 1 reacción ·
Los mantenedores suelen responder en 1 día
Todos los issues de WoltLab/WCF
Issues similares
-
bug: juros do parcelamento travados em 1x no gateway Rede Débito e Crédito 3DS (woo-rede 5.6.0)Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
LinkNacional/woo-rede#367 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Translation is missing for sw-app.component.sw-app-shop-id-change-modal.error.shop-id-change-failedAbiertoneeds-triage Platform(Default)
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Configuration consistency enhancement
Dificultad 2/5 Menos de una hora Aptitud para principiantes 72/100
novalo-dev/Prestashop-MCP-Server#405 ·
Los mantenedores suelen responder en 1 día
-
OpenRouter errors returned in a 200 body are thrown as a plain AiExceptionPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 2 días