Created
February 1, 2014 16:35
-
-
Save arikon/8754786 to your computer and use it in GitHub Desktop.
jQuery plugin with bem-core
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If you are using borschik to expand links (bem make and enb do this for you) | |
// you could use this hack for any jQuery plugin found in the wild | |
modules.define('i-jquery__my-plugin', ['jquery'], function(provide, $){ | |
var jQuery = $, | |
window = {jQuery: jQuery}; | |
/*borschik:include:path/to/jquery-plugin.js*/ | |
provide($); | |
}); |
что скажите про такую декларацию jQuery-плагина?
modules.define('i-bem__dom', ['jquery'], function(provide, $, DOM) {
window.jQuery = window.$ = $;
/*borschik:include:../../libs/jquery-plugin/js/jquery-plugin.js*/
provide(DOM);
});
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@arikon, @alexbaumgertner, все верно, перетирая window можно отгрести проблемы, пример - фоторама, которая без реального window не работает.