color.js 文件保存时自动检测color值变化, 根据依赖动态生成 SCSS | LESS | CSS color变量
npm install watch-color --save-dev
"watchFile": "./colors/color.js",
"outputDir": "./colors",
"scripts": {
"watch": "watchColor"
}
module.exports = {
bg: [
'#00000f',
], // create bg.scss | bg.less
font: [
'#eeeeee',
], // create font.scss | font.less
border: [
'#ffffff',
], // create border.scss | border.less
}
// bg
$--bg-color-0000ff: #0000ff;
// css var
:root {
--bg-color-0000ff: #{$--bg-color-0000ff};
}
// bg
@--bg-color-0000ff: #0000ff;
// css var
:root {
--bg-color-0000ff: ~"@{--bg-color-0000ff}";
}