Skip to content

Commit

Permalink
refactor(tailwind): migrate to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Dec 27, 2024
1 parent f1225f2 commit 6f938bc
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 333 deletions.
13 changes: 0 additions & 13 deletions packages/tailwind/.eslintignore

This file was deleted.

3 changes: 0 additions & 3 deletions packages/tailwind/.eslintrc.js

This file was deleted.

26 changes: 14 additions & 12 deletions packages/tailwind/build-colors.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
const {
theme: { colors }
} = require("./tailwind.config.js");
const fs = require("fs");

try {
fs.mkdirSync("./dist", { recursive: true });
} catch (er) {
console.error(er);
}

fs.writeFileSync("./dist/colors.json", JSON.stringify(colors, null, 2), { encoding: "utf8" });
import fs from "node:fs/promises";

import colors from "tailwindcss/colors.js";

import tailwindConfig from "./tailwind.config.js";

const mergedColors = {
...colors,
...tailwindConfig.theme.extend.colors
};

await fs.mkdir("./dist", { recursive: true }).catch(() => {});

await fs.writeFile("./dist/colors.json", JSON.stringify(mergedColors, null, 2), { encoding: "utf8" });
10 changes: 9 additions & 1 deletion packages/tailwind/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{
"name": "@tsed/tailwind",
"version": "2.3.2",
"type": "module",
"main": "./tailwind.config.js",
"module": "./tailwind.config.js",
"description": "Tailwind configuration",
"license": "MIT",
"private": true,
"exports": {
".": {
"source": "./tailwind.config.js",
"default": "./tailwind.config.js"
}
},
"scripts": {
"build": "node ./build-colors.js",
"tailwind:build": "tailwindcss-cli build -o build/tailwind.css && yarn tailwind:build:viewer",
Expand All @@ -15,7 +23,7 @@
"devDependencies": {
"rimraf": "3.0.2",
"tailwind-config-viewer": "^1.3.1",
"tailwindcss": "2.2.19",
"tailwindcss": "3.4.17",
"tailwindcss-cli": "0.1.2",
"tailwindcss-inset": "1.0.0",
"tailwindcss-transforms": "2.2.0"
Expand Down
Loading

0 comments on commit 6f938bc

Please sign in to comment.