csstools / csstools/postcss-color-mod-function

Used color-mod() in CSS variable is not working

オープン
#41 コメント 18 件 リアクション 2 件 担当者 0 名 GitHub で見る
bug help wanted
主要言語
JavaScript
スター
95
フォーク
14
PR マージ指標
30日以内にマージされた PR はありません

説明

Consider this webpack example

*webpack.config.js*
```
module.exports = (env, options) => {
return {
module : {
rules : [
{
test : /\.css$/,
use : [
{ loader : 'postcss-loader' },
],
},
],
},
plugins : [
]
};
};
```

*postcss.config.js*
```
module.exports = (api) => {
return {
plugins : [
['postcss-custom-properties'],
['postcss-color-mod-function'],
],
}
};
```

*file.css*
```
:root {
--myvar: color-mod(#1BB749 w(+10%) s(+1%));
}

.test1 { color: color-mod(#1BB749 w(+10%) s(+1%)); }
.test2 { color: var(--myvar); }
```

Output is
```
.test1 { color: hsl(137.69230769230768, 56.4140127389%, 46.1764705882%); }
.test2 { color: color-mod(#1BB749 w(+10%) s(+1%)); }
```

Why color-mod() in `.test2` is not processed? I have correct plugins order where postcss-custom-properties firstly process variable and secondly postcss-color-mod-function should process color-mod() but it is not processed.

The solution is only to use postcss-color-mod-function in webpack plugins section not in module.rules section but it have negative performance impact to process whole bundle with postcss-color-mod-function during watch or dev server with hot reload. So I would like it works in module.rules section as expected. Thanks.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

webpack.config.js、postcss.config.js、file.cssを使用して出力を再現します。module.rules、loader、pluginsの設定を追跡しながら.test1と.test2を比較します。変数を使用したcolor-mod()の出力が、バンドル全体の処理を必要とせずに直接使用した場合と一致すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
css, javascript, webpack
領域
build-system
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。