angular / angular/angular-cli

JS support for PostCSS config

未關閉
#27,819 9 則留言 42 個 reaction 已指派 0 人 在 GitHub 檢視
angular/build:application area: @angular/build feature feature: under consideration
主要語言
TypeScript
星號
27k
分支
11.8k
平均合併
14 小時 23 分鐘
30 天內合併 PR
162

描述

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

貢獻指南

開啟貢獻指南

研究方向

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.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript, typescript
領域
build-system, cli
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
50/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。