2012-12-19 4 views
11

meteor app에 requirej를 통합하고 (예 : Backbone 모듈 용) AMD 모듈을 사용하려면 어떻게해야합니까? 아무도이 작업을 수행하는 데 필요한 단계가 무엇인지 말해 줄 수 있습니까?요구 사항에 Meteor 사용하기

답변

4

하나의 간단한 답변 (찾고자하는 답변이 아닐 수도 있음)은 두 가지를 독립적으로 사용할 수 있다는 것입니다. 즉, 유성 스크립트를 모두로드 한 다음 필요에 따라 스크립트로드를 시작하십시오. 필요로하는 스크립트는 Require 's loader를 통해 그 중 어떤 것도 "가져 오기"할 필요없이 Meteor를 잘 사용할 수 있습니다.

을 가져 오려면을 가져 오려면 대신 "심"을 작성해야합니다.

+0

마지막 시간/commonjs 지원을 필요로한다. 필자는 유성에 대한 래퍼 플러그인을 작성하거나 유성 파일 시스템에 수동으로 필요한 파일을 복사하는 것이 유일한 방법이라고 생각합니다. – dsummersl

+0

https://gist.github.com/3922137 FS = __meteor_bootstrap __ 필요 ('FS') – crapthings

+0

@machineghost :. 난 그 노드의 commonjs 수입 생각 : 합리적인 접근 방식처럼 –

0

여기에 Meteor 및 IronRouter에 Aloha Editor을로드하는 방법이 나와 있습니다. 알로하는 requirejs을 사용하여 모든 종속성을로드합니다. 공공/alohaeditor에서

  1. 의 압축을 풀고 알로하 배포.
  2. aloha-common-extra.css를 제외한 모든 알로하 css 파일을 클라이언트/lib/alohaeditor (plugins 폴더의 파일을 잊지 마세요)로 이동하십시오.
  3. 모든 알로하 CSS 파일에서 상대 경로를 절대 경로로 바꿉니다 ('../'를 '/ alohaeditor /'로 바꿉니다).
  4. wait-on-lib Meteor 패키지를 설치하십시오.
  5. 는 경로에 다음 훅을 추가 : 그것은하지 않았다 나는 유성 (v0.4)으로 연주

    onBeforeAction: function(pause) 
        {   
        // Dynamically load require.js 
        var one = IRLibLoader.load('/alohaeditor/lib/require.js', 
         { 
         success: function(){ console.log('Successfully loaded require.js'); }, 
         error: function(){ console.log('Error loading require.js'); } 
         }); 
        if(!one.ready()) 
         return pause(); 
    
        // Aloha settings 
        Aloha = window.Aloha || {}; 
        Aloha.settings = Aloha.settings || {}; 
        Aloha.settings.baseUrl = '/alohaeditor/lib/'; 
        Aloha.settings.plugins = Aloha.settings.plugins || {}; 
        Aloha.settings.plugins.load = 'common/ui, common/format, common/link, common/table, common/list, common/block, common/undo, common/contenthandler, common/paste, common/commands, common/abbr'; 
    
        // Dynamically load aloha.js 
        var two = IRLibLoader.load('/alohaeditor/lib/aloha.js', 
         { 
         success: function(){ console.log('Successfully loaded aloha.js'); }, 
         error: function(){ console.log('Error loading aloha.js'); } 
         }); 
        if(!two.ready()) 
         return pause(); 
        }, 
    
관련 문제