csstools / csstools/postcss-color-mod-function

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

Aperta
#41 18 commenti 2 reazioni 0 assegnatari Vedi su GitHub
bug help wanted
Lingua principale
JavaScript
Stelle
95
Fork
14
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Reproduce the output using webpack.config.js, postcss.config.js, and file.css. Compare .test1 and .test2 while tracing the module.rules loader and plugins configuration; done means the variable-based color-mod() output matches direct use without requiring whole-bundle processing.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
css, javascript, webpack
Ambito
build-system
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.