Skip to content

Instantly share code, notes, and snippets.

// task:nunjucks
gulp.task('nunjucks', function(){
return gulp.src(paths.src.html + '**/*.njk')
.pipe(nunjucks({
path: paths.src.template
}))
.pipe(gulp.dest(paths.dest.root))
});
@867
867 / blog-nunjucks-site.json
Created July 9, 2018 11:18
公式ブログ用:site.json
{
"data" : {
"sitename" : "sample site",
"meta" : {
"description" : "",
"keywords" : ""
},
"og" : {
"type" : "article",
"image" : "/assets/img/ogp/og-def-01.png"
@867
867 / blog-nunjucks-parts02.js
Last active July 12, 2018 05:21
公式ブログ用:gulpfile.js : gulp-data
// task:nunjucks
gulp.task('nunjucks', function(){
return gulp.src(paths.src.html + '**/*.njk')
.pipe(data(function(){
return require(paths.src.json);
}))
.pipe(nunjucks({
path: paths.src.template
}))
.pipe(gulp.dest(paths.dest.root))
@867
867 / blog-nunjucks-parts03.js
Last active July 12, 2018 05:23
公式ブログ用:gulpfile.js : gulp-beautify
// set:beautify_option
const beautify_option = {
'indent_size': 2
}
// task:nunjucks
gulp.task('nunjucks', function(){
return gulp.src(paths.src.html + '**/*.njk')
.pipe(data(function(){
return require(paths.src.json);
@867
867 / blog-nunjucks-template-01.njk
Created July 12, 2018 05:44
公式ブログ用:Nunjucks : layout/_default.njk
<!DOCTYPE html>
<html lang="ja">
<head>
{% include 'partial/site/_dochead.njk' -%}
<!-- GTMタグなど -->
</head>
<body>
<!-- GTMタグなど -->
{% include 'partial/site/_header.njk' -%}
{% block contents -%}{%- endblock %}
@867
867 / blog-nunjucks-template-02.njk
Last active July 13, 2018 08:41
公式ブログ用:Nunjucks : page/index.njk
{% extends 'layout/_default.njk' %}
{% set pageT = 'グランドトップ' %}
{% set pageD = 'GTディスクリプション' %}
{% set pageK = 'キーワード1,キーワード2' %}
{% set ogType = 'website' %}
{% block contents -%}
<p>グランドトップのコンテンツ</p>
{%- endblock %}
@867
867 / blog-nunjucks-template-03.njk
Last active July 12, 2018 07:37
公式ブログ用:Nunjucks : partial/_dochead.njk
{%- if pageT -%}
{%- set title = pageT + ' | ' + data.sitename -%}{%- else -%}
{%- set title = data.sitename -%}
{%- endif -%}
{%- if pageD -%}
{%- set description = pageD -%}{%- else -%}
{%- set description = data.meta.description -%}
{%- endif -%}
{%- if pageK -%}
{%- set keywords = pageK -%}{%- else -%}
@867
867 / blog-nunjucks-template.html
Last active July 13, 2018 08:42
公式ブログ用:Nunjucks : html/index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>グランドトップ | sample site</title>
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="description" content="GTディスクリプション">
<meta name="keywords" content="キーワード1,キーワード2">
<meta name="viewport" content="width=device-width, initial-scale=1">
@867
867 / blog-nunjucks-news-01.njk
Last active March 11, 2019 06:57
公式ブログ用:Nunjucks-news1
{% set news_category1 = '' %}
{% set news_category2 = '' %}
{% set news_amount = 5 %}
{% block contents -%}
<section>
<header>
<h2>ニュース</h2>
</header>
<ul>
@867
867 / blog-nunjucks-news-02.njk
Last active March 11, 2019 06:56
公式ブログ用:Nunjucks-news2
{% set news_category1 = 'pro' %}
{% set news_category2 = '' %}
{% set news_current = 1 %}
{% block contents -%}
<section>
<header>
<h2>ニュース>製品情報</h2>
</header>