Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #12783
Closed
Open
Issue created Feb 19, 2014 by Administrator@rootContributor

Added AMD/CommonJS support

Created by: pherrymason

Hello, I have an almost ready modification to add support for both AMD and CommonJS modules, but before doing the pull request I want to know if this is a desired change by bootstrap maintainers.

I just implemented the schema seen here https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js, which is almost identically to what @liamks posted in #534, but with the difference this supports CommonJS too.

I have tested it with a CommonJS environment (webpack) and under classical plain globals, however I'm not pretty sure how to write the AMD part (I'm a CommonJS guy) where the transition plugin is used, specifically how to add the transition plugin as a dependency.

What about this?

(function (factory) {
  if (typeof define === 'function' && define.amd) {
    define(['jquery', './transition.js'], factory)
  } else if (typeof exports === 'object') {
    var jQuery = require('jquery')
    require('./transition.js')
    factory(jQuery)
  } else {
    factory(this.jQuery)
  }
}(function ($) {
Assignee
Assign to
Time tracking