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

Add AMD/RequireJS and CommonJS #264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

matthieuy
Copy link

This PR add support for AMD/RequireJS and CommonJS.
Now we can use this script with npm, webpack,... :

var slidebars = require('slidebars');
var controller = new slidebars();

Fix the issue #256 and partially the #122 without break the actual code

@ghost
Copy link

ghost commented Mar 2, 2017

We need this one for sure!

@jonny-harte
Copy link

agreed!

@justijndepover
Copy link

please merge this pull request!

@Nubuck
Copy link

Nubuck commented Jun 25, 2017

If you're still waiting for this merge and using Webpack 2 you can use exports-loader

I've included slidebars using exports-loader and the webpack provide plugin:

...
 new Webpack.ProvidePlugin({
  slidebars: 'exports-loader?slidebars!slidebars/dist/slidebars',
}),
...

This makes sidebars globally available, which can be initialized like so:

$(document).ready(() => {
  const controller = new slidebars()
  controller.init()
})

@matthieuy
Copy link
Author

@Nubuck : Thanks, it's works well !

@pkid169
Copy link

pkid169 commented Sep 27, 2017

Any plan of merging this? Seems like a much needed feature!

@jaredh159
Copy link

If you don't want to use the plugin @Nubuck mentions above, you can depend on my fork which includes CommonJS/AMD support and plays nice with webpack out of the box. Just change your package.json to depend on:

"slidebars": "git+ssh://[email protected]/jaredh159/Slidebars.git#3.0.0"

And then yarn or npm install.

@justijndepover
Copy link

I have sent an email to Adam (owner / creator) to ask if he can merge this request! 🤞

@deltoss
Copy link

deltoss commented Feb 25, 2019

Another way to import slidebars instead of using the provide plugin to make it globally available (which I find a bit too magical), you can:

  1. Install exports-loader plugin:
    npm install exports-loader --save-dev
  2. In your js file, compiled by webpack:
    var slidebars = require('exports-loader?slidebars!slidebars/dist/slidebars');

Note sure if it's best practice or not though.

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.

7 participants