angular / angular/angular-cli

JS support for PostCSS config

Offen
#27,819 9 Kommentare 42 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
angular/build:application area: @angular/build feature feature: under consideration
Vorherrschende Sprache
TypeScript
Sterne
27k
Forks
11.8k
Ø Merge
14 Std. 23 Min.
Gemergte PRs (30 T.)
162

Beschreibung

### 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_

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript
Bereich
build-system, cli
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
50/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.