2017-04-15 9 views
0

필자는 Typescript 및 Angular 4를 사용하기가 매우 쉽습니다. 각형 CLI 설정과 Google Code-Prettify를 통합하는 데 문제가 있습니다.Typscript 및 각도 4로 Google Code-Prettify 사용하기

내 구성 요소와 함께 동적으로 사용하도록 코드를 미리 가져 오는 방법을 알아 내려고했지만이 방법을 확신 할 수 없습니다.

NPM으로 설치하고 패키지에서 PR을 가져 오려고했지만 PR이 빈 개체로 제공됩니다.

내가 수행하려는 것을 성취 할 수있는 방법이 있습니까?

감사

답변

1
you can change some code in prettify.js: 


             
  
//old code in here 
 
if (typeof define === "function" && define['amd']) { 
 
    define("google-code-prettify", [], function() { 
 
    \t return PR; 
 
    \t }); 
 
} 
 
//new code in here 
 
     
 
if(typeof module==="object"&&typeof module.exports==="object") { 
 
    module.exports = PR; 
 
} else if (typeof define === "function" && define['amd']) { 
 
    define("google-code-prettify", [], function() { 
 
    \t return PR; 
 
    }); 
 
}
use case like this:
let prettify = require('../../dep/prettify'); 
 
$("#doc-view").html(virtualDom); 
 
prettify.prettyPrint();
+0

나는 아직이 시도 할 수있는 기회를 잡았으나 정확히 내가 찾던처럼 보이는하지 않았습니다. 감사! – Mattador