Skip to content

Instantly share code, notes, and snippets.

doctype html
html(lang="ja")
head
meta(charset="utf-8")
title Pugレッスン
body
h1 Pug始めました
main.main
p Pugでhtml作ったよ
ul
li: a(href="#") List01
li: a(href="#") List02
li: a(href="#") List03
#id-name DivタグにIDを振る
.class-name DivタグにClassをつける
ul
- for (var i = 0; i <= 3; i++) {
.item
li List0#{i}
- }
- var url = "//www.example.com/";
a(href=url) トップページ
a(href=url + "contact/") お問い合わせ
- var title = { home: "トップページ" }
if title.home
h2 #{title.home}
else
h2 title.lower
/* css */
.list-family ol{
list-style: none;
counter-reset: cnt;
padding-left: 0;
}
.list-family ol li{
margin-bottom: 8px;
}
.list-family ol li::before{
/* css */
.numbering {
margin: 0;
counter-reset: number;
}
.numbering h2::before {
counter-increment: number;
content: counter(number);
padding-right: 5px;
}
- var author = ['ゆうさん', 'ゆきぱんだ', 'Tantan', 'かみーゆ', 'しゃーまん']
ul
each item, index in author
li #{index + item}
//- ごちゃ混ぜ
p こんにちは。<br>フロントエンドエンジニアの <strong>かみーゆ</strong> です。
//- =でコンテンツを渡す
p= 'こんにちは。フロントエンドエンジニアのかみーゆです。'
//- エスケープ
p= '段落は<p>タグで囲みます'
//- エスケープしたくない