How could I make a CSS variable autocomplete work? #285
-
I am using CSS Variable Autocomplete which is VSCode extensions, But I cannot make it auto completed using colors in Is that possible to build color variables before build? |
Beta Was this translation helpful? Give feedback.
Answered by
FourwingsY
Nov 2, 2024
Replies: 1 comment
-
with Next15, colors could be extracted as an "scripts": {
"predev": "tsx ./scripts/predev.mts",
"dev": "next dev"
} import fs from 'fs';
import { Colors } from '../app/lib/style/colors';
// write colors as css
const colors = Object.entries(Colors)
.map(([name, value]) => `--colors-${name}: ${value};`)
.join('\n');
const css = `:root {\n${colors}\n}`;
// write css to file. make sure './build' is added on `.gitignore`
fs.mkdirSync('./build/style', { recursive: true });
fs.writeFileSync('./build/style/colors.css', css); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
FourwingsY
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
with Next15, colors could be extracted as an
.ts
file,So I just made a "predev" scripts to make theme as static css file.