这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@loganmac
Copy link

@loganmac loganmac commented Sep 5, 2023

When prettier is executed by user's editors, like VS Code, the calls to process.cwd() can return null. This is usually because the process is being run in a folder that doesn't exist.

This fix extends the getIconCollections function to accept a dir parameter when called, so that you can pass the directory of your tailwind.config.js file in with __dirname. The default value for the parameter for the function should also make it backwards compatible with the old way it was called.

Fixes the issues some users are still having with #3, #9, #16. Note that the users will have to update their tailwind.config.js like so:

const { iconsPlugin, getIconCollections } = require("@egoist/tailwindcss-icons")
module.exports = {
  plugins: [
    iconsPlugin({
      // Select the icon collections you want to use
      // collections: getIconCollections(["mdi", "lucide"]), <- old way of configuring plugin
      collections: getIconCollections(["mdi", "lucide"], __dirname), // <- new way
    }),
  ],
}

@codesandbox
Copy link

codesandbox bot commented Sep 5, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

egoist added a commit that referenced this pull request Sep 23, 2023
@egoist
Copy link
Owner

egoist commented Sep 23, 2023

My previous fix (without introducing a new argument) only fixed it on macOS, I just made a new release, let me know if it works now

@egoist egoist closed this Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants