2016-08-11 4 views
0

그래서 Polymer를 사용하여 간단한 hello world 페이지를 작성하려고합니다. 내가 가지고있는 문제는 #polymer serve 명령을 실행하고 내 웹 페이지를로드 할 때마다 webcomponents.min.jsiron-component-page.html을 찾을 수 없다는 것입니다. 왜 이런 일이 벌어지고 어떻게 해결할 수 있습니까?Polymer - 404를 찾을 수 없음

<!doctype html> 

<html> 
    <head> 
    <title>polymer-element</title> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <script src="../webcomponentsjs/webcomponents-lite.js"></script> 
    <link rel="import" href="../iron-component-page/iron-component-page.html"> 
    </head> 
    <body> 
    <iron-component-page src="polymer-element.html"></iron-component-page> 
    </body> 
</html> 

enter image description here

index.html을 나는 here 주어진 몇 가지 답변을 시도했지만 여전히 동작하지 않습니다.

+0

음, index.html의 URL이 잘못되었을 수 있습니다. 'bower_components/iron-component-page/iron-component-page.htm'과 같이 해보시겠습니까? –

답변

0

나는 아직 그것을 이해하지 못했지만 폴리머는 후드 아래에서 polyserve를 사용하고 있으며, URL을 사용하여 디렉토리 매핑을 작성하는 것이 현명하다고 생각합니다. 나는 그것이 재사용 가능한 컴포넌트를 개발할 디렉토리 구조를 가정하므로 요소가 bower_components에있을 때 ../web-component/web-component.html로 가서 가져 오기를 찾는다. 그러나 개발 구조는 가정한다. 실제로 컴포넌트를 개발중인 디렉토리 내에 bower_components가 있습니다.

응용 프로그램을 처리 할 때 "bower_components"를 내 응용 프로그램 디렉토리의 경로에 넣고 "src"디렉토리의 요소를 하위 디렉토리로 배치합니다. 그. 그렇다면 내 html 가져 오기에서 명시 적으로 /bower_components/web-component/web-component.html을 사용합니다. 당신의 작업 디렉토리를 가정하고있다 "X"및 구성 요소는 "X/구성 요소"에 따라서 소프트 링크를 만듭니다

실행 폴리머 앱 루트에서 역할은 localhost:8080/

0

짧은 대답가에서 것을 제공 :

$ ln -s components bower_components

긴 대답 :

폴리머 제공하지 않습니다 자체 그들에게 .bowerrc를 읽고/명예롭게.

내 구성 요소 디렉토리는 모든 고분자 구성 요소가 존재하는 "구성 요소"입니다.

.bowerrc -> { "디렉토리": "구성 요소"} "폴리머 봉사"실행

서버를 시작,하지만 난 "http://localhost:8000/index.html"에 탐색 할 때, 나는 빈 페이지를 얻을.

브라우저에서 네트워크 트래픽을 검사하면 webcomponentjs *에 대한 모든 요청이 404를 반환합니다.

그래서 .. polymer serve은 기본이 아닌 구성 요소 디렉토리를 따르지 않습니다. bower-components dir이 (가) 있습니다.

관련 문제