Scara 템플릿을 이해하면서 템플릿의 HTML 해석
이번 목표는 이쪽을 이해하는 거예요
main.scala.html
@*
* This template is called from the `index` template. This template
* handles the rendering of the page header and body tags. It takes
* two arguments, a `String` for the title of the page and an `Html`
* object to insert into the body of the page.
*@
@(title: String)(content: Html)
<!DOCTYPE html>
<html lang="en">
<head>
@* Here's where we render the page title `String`. *@
<title>@title</title>
<link rel="stylesheet" media="screen" href="@routes.Assets.versioned("stylesheets/main.css")">
<link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png")">
</head>
<body>
@* And here's where we render the `Html` object containing
* the page content. *@
@content
<script src="@routes.Assets.versioned("javascripts/main.js")" type="text/javascript"></script>
</body>
</html>
이 문서의 출처
이 파일은play-sala-seed 템플릿
sbt new
을 사용하면view에 있습니다.시작 - 매개변수 섹션
먼저 설명문을 쓰다.
@*
* This template is called from the `index` template. This template
* handles the rendering of the page header and body tags. It takes
* two arguments, a `String` for the title of the page and an `Html`
* object to insert into the body of the page.
*@
이 템플릿은 색인 템플릿에서 가져옵니다.이 템플릿은 페이지의 눈썹과 바디 탭을 조작하는 데 사용됩니다.매개 변수 중필요
매개변수는 다음과 같습니다.
@(title: String)(content: Html)
참고로 댓글은 @* *@
로 썼어요.HTML 섹션
<!DOCTYPE html>
<html lang="en">
<head>
@* Here's where we render the page title `String`. *@
<title>@title</title>
<link rel="stylesheet" media="screen" href="@routes.Assets.versioned("stylesheets/main.css")">
<link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png")">
</head>
<body>
@* And here's where we render the `Html` object containing
* the page content. *@
@content
<script src="@routes.Assets.versioned("javascripts/main.js")" type="text/javascript"></script>
</body>
</html>
모양은 거의 일반 HTML입니다.scala 템플릿에서 다섯 번째 줄 @title
과 12 줄 @content
처럼 @ 뒤에 변수 이름을 기술합니다.href 속성의 @routes.Assets.versioned의 기술
기본적으로
@routes.Assets.
면public 폴더를 볼 수 있습니다.즉, 공공 폴더 아래는 이렇다.어떻게 조작해야 할지 알기 전에 정부에서도 이 사용법을 추천합니다public
- javascripts
- stylesheets
- images
controllers.routes.Assets
에서 설정된Assets 폴더에 지정한 경로와 이 기술을 변환하는 컨트롤러를 만들었습니다. 구축할 때 설정된 경로로 바꾸는 구조인 것 같습니다.참조 페이지
Reference
이 문제에 관하여(Scara 템플릿을 이해하면서 템플릿의 HTML 해석), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/yassh_i/articles/a5efc6519c9d4d텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)