2012-02-19 4 views
8

음, 빌드와 도장에 관한 모든 것을 읽었습니다. 3 일 악몽 등 ... 도움이 필요해.도조에서 빌드하기 1.7.2

저는 마지막 버전의 도장을 사용하고 있습니다. 1.7.2 지역 : 내가

./build.sh profile=../../../../myApp/myApp.profile.js releaseDir=../../../release 

이 빌드 스크립트를 사용하여 다음

dependencies = { 
stripConsole: "all", 
action: "release", 
optimize: "shrinksafe", 
layerOptimize: "shrinksafe", 
//optimize: "closure", 
//layerOptimize: "closure", 
//mini: true, 
//localeList : 'en-us', 
//cssOptimize: "comments",  
//selectorEngine: "acme", 
releaseName: "content7", 
layers: [ 
{ 
    // This is a specially named layer, literally 'dojo.js' 
    // adding dependencies to this layer will include the modules 
    // in addition to the standard dojo.js base APIs. 
    name: "dojo.js", 
    customBase : true, 
     dependencies: [ 
      "dojo.fx", 
      "dijit.form.Button",    
      "dojox.gauges.AnalogGauge", 
      "dojox.gauges.AnalogArcIndicator", 
      "dojox.gauges.AnalogNeedleIndicator", 
      "myApp.smartmix" 
    ]   
    } 
], 
prefixes: [ 
    [ "dijit", "../dijit" ], 
    [ "dojox", "../dojox" ], 
    [ "myApp", "../../../myApp" ] 
] 
}; 

그리고 나는

을 가지고 :

</sites/somesite/scripts/dojo17> 
which contains 
--dojo 
--dijit 
--dojox 
--utils 

나는 다음과 같은 프로파일을 사용

375,지금 내 index.html 파일에 나는

<script type="text/javascript"> 
//<![CDATA[ 
    var djConfig = { 
     parseOnLoad: true, 
     isDebug: false, 
     modulePaths: { 
      'myApp': '../myApp' 
     } 
    }; 
//]]> 
</script> 

<script type="text/javascript" src="scripts/release/content7/dojo/dojo.js"></script> 

<script> 
    dojo.require('myApp.smartmix'); 
</script> 

을 그리고 YES이 153 개 파일을 빌드하지 않고로드 (230 개) 파일을 줄일 수 있습니다. 하지만 여전히 하나 또는 두 개의 파일로 축소 할 수 있다고 믿고 싶습니다.

하지만 HOW ?????

제발, 어떤 도움을 주시면 감사하겠습니다 !!!!

답변

1

귀하의 프로필이 올바르지 않습니다.

첫 번째로 : 최소 버전의 dojo core를 작성하기위한 고급 특성 인 customBase을 사용하고 있습니다. 네가 그걸 원한다고 생각하지 않아, 그렇지? 일반적으로 dojo가 코어를 정상적으로 빌드하게하고, 출력 도우에서 dojo.js로 끝납니다. 의 2

모든 : 모든 layer 항목이 축소 된의 .js가 내부 dependencies에있는 모든 파일과 파일이 생성됩니다.

따라서 빌드 된 JS 파일에 myApp 콘텐츠가 필요하면 레이어를 만들고 파일을 종속 파일에 저장해야합니다.

Dojo는 여전히 모든 개별 파일을 생성하지만이를 배치 할 필요는 없습니다. 레이어 파일 만 배포하면됩니다. 보통 Dojo 코어를위한 레이어, 내가 원하는 dijit/dojox 레이어, 그리고 내 사용자 정의 JS 레이어가 있습니다. 그러면 dojo가 dojo 디렉토리에서 출력 할 3 개의 JS 파일이 있으며 HTML 페이지에서 사용됩니다.

+0

** 1 ** : 정말 아주 약간의 .js를 원하기 때문에 확인 지금 막 들어,'customBase'를 제거합니다. ** 둘째 ** : 내 html이 다른 모든 .js (153 개 파일 !!!!)를 호출 할 필요가 없도록 모든 종속성이있는 축소 된 .js가 필요합니다. *** 셋째 *** 빌드가 여전히 153 개의 파일을 만들었습니다. 난 단지 하나의 파일 안에 모든 의존성이 있어야한다. – Agustincl

+0

Dojo는 여전히 모든 개별 파일을 작성하지만이를 배치 할 필요는 없습니다. 계층에 대해 생성 된 파일 만 배포하면됩니다. 나는 * 모든 * 사용자 정의 JS를 모으는 계층이있는 사용자 프로필에는 표시되지 않으며 사용자가 필요합니다. – mtyson

0
... 
layers: [ 
{ 
// this is a layer 'application', which will cache all 
// dependencies to smartmix and declare smartmix in the same file 
    name: "../../../myApp/smartmix.js", 
     dependencies: [ 
      "dojo.fx", 
      "dijit.form.Button",    
      "dojox.gauges.AnalogGauge", 
      "dojox.gauges.AnalogArcIndicator", 
      "dojox.gauges.AnalogNeedleIndicator", 
      "myApp.smartmix" 
    ]   
    } 
], 
... 

두 개의 요청 만 필요합니다.

<script src=..dojo.js></script>

<script>require(["myApp.smartmix"], function(smartmixApplication) { });</script>