2014-02-21 2 views
0

내 BackboneJS/RequireJS 앱에서 이미지 Lazyload.js 플러그인을 사용하고 싶지만이를 수행하는 방법을 모릅니다. 아무도 힌트를 줄 수 있습니까?RequireJS 및 BackboneJS에 Jquery 플러그인을 포함하는 방법

define(["jquery"], 
    function($){ 
    ... 
}); 
: 나는 몇 가지를 적용해야하는 것이 내가 읽은

require.config({ 

paths: { 
     jquery: '../lib/jquery-2.0.3.min', 
     underscore: '../lib/lodash-2.2.1.min', 
     backbone: '../lib/backbone-1.0.0.min',  
    lazyload: '../lib/jquery.lazyload.min' 
}, 

shim: {backbone, handlebars etc...} 

}); 

이 내가 이미 다운로드 내 config.js에 정의 lazyload plugin

을 사용하고자하는 플러그인입니다 플러그 코드의 끝에

?

답변

0

내 파일을 복사하고 있습니다. 이걸로 jquery 플러그인/파일을 백본에서 작성하는 방법을 알 수 있습니다. 이렇게 main.js를 작성하십시오. 너의 누락 된 상사를 생각해.

require.config({ 
     baseURL: 'scripts', 
     paths: { 
     jquery: "../../lib/js/zepto/zepto", 
     Underscore: "../../lib/js/underscore-amd/underscore", 
     Backbone: "../../lib/js/backbone-amd/backbone", 
     text: "../../lib/js/requirejs-text/text", 
     ChromeExtension: "../chrome-extension", 
     Config: "../config", 
     Constants: "../constants", 
     NotificationService: "notification-service", 
     SocketIO: "../../lib/js/socket.io-client/socket.io", 
     deffered: "../../lib/js/simply-deffered/deferred", 
     PusherClient: "../../lib/js/pusher/pusher.min" 
     }, 
     shim: { 
     Constants: { 
      deps: ['Config'] 
     }, 
     jquery: { 
      deps: [], 
      exports: '$', 
      init: function() { 
      return window.jQuery = $; 
      } 
     }, 
     Backbone: { 
      deps: ['jquery', 'Underscore'], 
      exports: 'Backbone' 
     }, 
     Underscore: { 
      exports: '_' 
     }, 
     NotificationService: { 
      deps: ['SocketIO', 'Backbone'] 
     }, 
     deffered: { 
      deps: ['jquery'], 
      exports: 'Deffered' 
     }, 
     PusherClient: { 
      deps: [], 
      exports: 'PusherClient' 
     } 
     } 
    }); 
관련 문제