datasquirel/package-shared/shell/tailwindWatch.ts

37 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-01-10 19:10:28 +00:00
import fs from "fs";
import { exec } from "child_process";
require("dotenv").config({ path: "./../.env" });
const sourceFile =
process.argv.indexOf("--src") >= 0
? process.argv[process.argv.indexOf("--src") + 1]
: null;
const destinationFile =
process.argv.indexOf("--dst") >= 0
? process.argv[process.argv.indexOf("--dst") + 1]
: null;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
console.log("Running Tailwind CSS compiler ...");
fs.watch("./../", (curr, prev) => {
exec(
`npx tailwindcss -i ./tailwind/main.css -o ./styles/tailwind.css`,
(error, stdout, stderr) => {
if (error) {
console.log("ERROR =>", error.message);
return;
}
console.log("Tailwind CSS Compilation \x1b[32msuccessful\x1b[0m!");
}
);
});