Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

supporting eyeglass modules that already have their own main. #10

Closed
chriseppstein opened this issue Feb 13, 2015 · 2 comments
Closed
Labels

Comments

@chriseppstein
Copy link
Contributor

A lot of existing sass packages are already npm modules for one reason or another and they might have their own main script that does something completely different from the standard.

Specifically, I'm trying to support making true an eyeglass module.

A few options I see:

  1. Try to require("my_npm_module/eyeglass-exports") and fall back to require("my_npm_module") if that doesn't work.
  2. Always require("my_npm_module") but first check for require("my_npm_module").eyeglass so that if the can return an eyeglass function attached to some other object.
  3. Don't support this... they would need to make a new npm module that wraps their other one and conforms to our existing api.
@jakobo
Copy link
Contributor

jakobo commented Feb 13, 2015

I think I might prefer an eyeglass / eyeglass-exports property in package.json which we will resolve and read in. Using our resolve function does properly resolve my_npm_module/package.json. This can override a main property for npm modules that intend main to be something else but still want to integrate with eyeglass.

This pattern has been used in other libraries that want to know more about npm modules without necessarily forcing main adoption or alterations.

For true, the change would then be to add an eyeglass / eyeglass-exports property to package.json, along with the corresponding eyeglass-exports.js (which can also include settings & directory info from a common location, because DRY). This also makes sense because package.json is where they will be tagging the item as eyeglass-module anyway.

@chriseppstein
Copy link
Contributor Author

Fixed by 7f978df

chriseppstein pushed a commit that referenced this issue Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants