Skip to content

UMD #2215

Description

@jamesplease

Supersedes #2065 and #1433

The built version of Chosen only works with browser globals. Browser globals are falling out of fashion in favor of using module loaders, like AMD or CJS. Unfortunately, it's a bit of a pain for developers using those systems to integrate Chosen into them.

You can support the most common use cases of Chosen with a (fairly ugly) wrapper. Chosen's wrapper looks like this.

There's no question that it really sucks to include the wrapper, because it's added source code, but some folks feel that the benefits outweigh the cons. Some of the benefits are:

  • Chosen works with AMD and CJS out of the box
  • You don't force developers to use browser globals to use with Chosen
  • It would makes sense to publish Chosen on NPM, because it will work in Node
  • I can delete my fork of the project : D

Applying the wrapper can be easily done with an extra grunt task. I usually use grunt-preprocessor to wrap my files. I can make the PR if you wish.

If you add the wrapper, I would suggest that you add the repo to npm. Then, you could run npm publish after you've built the library to be distributed as a zip file, and the npm version would get the updated build.

whatcha think ❓

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions