angular / angular/angular-cli

JS support for PostCSS config

Abierto
#27,819 9 comentarios 42 reacciones 0 asignados Ver en GitHub
angular/build:application area: @angular/build feature feature: under consideration
Lenguaje dominante
TypeScript
Estrellas
27k
Forks
11.8k
Merge medio
14 h 23 min
PR fusionados (30 d)
162

Descripción

### Command

config

### Description

Currently the CLI supports custom PostCSS configurations in the format of JSON files. The problem is that the JSON format has its limitation. In our case for example we try to configure CSS purging with the `fullhuman/postcss-purgecss` plugin.

```json
{
"plugins": {
"@fullhuman/postcss-purgecss": {
"content": ["**/*.html", "**/*.ts", "**/*.js"],
"skippedContentGlobs": ["node_modules/**"],
}
}
}
```

Unfortunately this config is not enough and therefore we would need to configure some extractors:

```javascript
import purgeJs from "purgecss-from-js";
import purgeHtml from "purgecss-from-html";

const options = {
content: [], // files to extract the selectors from
css: [], // css
extractors: [
{
extractor: purgeJs,
extensions: ["js"],
},
{
extractor: purgeHtml,
extensions: ["html"],
},
],
};
export default options;
```

### Describe the solution you'd like
Support PostCSS configuration files writen in JavaScript.

### Describe alternatives you've considered
_No response_

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start at the CLI's config command and trace how JSON PostCSS configuration files are located, loaded, and passed to PostCSS. Review the existing configuration tests before deciding where JavaScript module loading belongs. Done means a JavaScript PostCSS config can be discovered and used with custom extractor functions, while existing JSON configuration still works.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, typescript
Área
build-system, cli
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
50/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.