LoginSignup
2
2

More than 5 years have passed since last update.

ECTとは?

テンプレートエンジンです.

公式サイト
ECT - Fastest JavaScript template engine with CoffeeScript syntax

ECTの凄さは他の方が書かれた記事が優れているのでそちらをご覧になったほうがいいかと.
ectの検索結果 - Qiita

テンプレート

layout.ect
<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="utf-8">
  <meta name="keywords" content="<%- @keywords %>">
  <meta name="description" content="<%- @description %>">
  <meta property="og:type" content="<%- @og_type %>">
  <meta property="og:title" content="<%- @title %>">
  <meta property="og:image" content="<%- @og_image %>">
  <meta property="og:url" content="<%- @og_url %>">
  <meta property="og:description" content="<%- @description %>">
  <meta property="og:site_name" content="<%- @og_site %>">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  <link rel="shortcut icon" href="/favicon.ico">
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">
  <% include 'style' %>
  <title><%- @title %></title>
</head>
<body>
  <% content %>
  <% include 'script' %>
</body>
</html>
style.ect
<link rel="stylesheet" href="stylesheets/normalize.css">
<link rel="stylesheet" href="stylesheets/style.css">
<% content 'style' %>
script.ect
<script src="javascripts/main.js"></script>
<% content 'script' %>

使用例

例えばindex.ectで使用する場合は

index.ect
<% extend 'layout' %>
  <div class="wrapper">
    <header role="banner">
      <h1></h1>
    </header>
    <main role="main">
    </main>
    <footer role="contentinfo">
    </footer>
  </div>
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2