Untitled

 avatar
unknown
plain_text
25 days ago
472 B
2
Indexable
 const fs = require("fs");
const path = require("path");

const indexFilePath = path.resolve(__dirname, "../../lib/index.js");
const cssImport = `import './main.css';\n`;

// Check if the import is already added
const fileContent = fs.readFileSync(indexFilePath, "utf8");
if (!fileContent.includes(cssImport)) {
  // Prepend the CSS import to index.js
  fs.writeFileSync(indexFilePath, cssImport + fileContent);
  console.log("CSS import added to index.js");
}
Leave a Comment