Skip to content

Commit

Permalink
fix(ui): buildCssModules 내 script 수정 (#115)
Browse files Browse the repository at this point in the history
* fix build css module script

* changeset
  • Loading branch information
Brokyeom authored Aug 20, 2024
1 parent 7b8570a commit eef3061
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/twenty-tables-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sopt-makers/ui": patch
---

fix css module build script in buildCSSModules.js
22 changes: 7 additions & 15 deletions packages/ui/scripts/buildCssModules.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
/* eslint-disable no-undef -- require import 오류 */
const fs = require("node:fs");
const path = require("node:path");
const allVariables = require("../dist/cssVariables");
const outputDir = require("../tsconfig.json").compilerOptions.outDir;
const fs = require('node:fs');
const path = require('node:path');
const allVariables = require('../dist/cssVariables');
const outputDir = require('../tsconfig.json').compilerOptions.outDir;

Object.keys(allVariables).forEach((key) => {
const variableValues = Object.entries(allVariables).find(
([name]) => name === key
)[1];
const variableValues = Object.entries(allVariables).find(([name]) => name === key)[1];

fs.writeFileSync(
path.join(outputDir, `${toFileName(key)}.css`),
`${variableValues}`
);
fs.writeFileSync(path.join(outputDir, `${toFileName(key)}.css`), `${variableValues}`);
});

function toCssCasing(str) {
return str
.replace(/(?:[a-z])/g, "$1")
.replace(/(?:[A-Z])/g, "-$1")
.toLowerCase();
return str.replace(/(?:[a-z])(?:[A-Z])/g, (match) => `${match[0]}-${match[1]}`).toLowerCase();
}

function toFileName(str) {
Expand Down

0 comments on commit eef3061

Please sign in to comment.