assemble: {
site: {
options: {
layoutdir: 'dev/assemble-layouts', // 各ページのYFMで指定するレイアウトファイル(layout:)設置場所のパス
data: ['dev/assemble-datas/**/*.{json,yml}'], // 各hbsファイルから変数として呼び出すファイル群の指定
partials: ['src/includes/**/*.hbs'], // 各hbsファイルから呼び出すテンプレートhtml(.hbs)ファイルを指定
flatten: false, // true にすると、生成するファイル群からディレクトリパスを削除??
helpers: [
'handlebars-helper-prettify'
],
prettify: {
condense: true,
indent_char: ' ',
indent: 1,
unformatted: ['br']
}
},
dest: 'assemble/', // 生成するファイルの保存先
src: ['dev/*.hbs'] // ここで指定したファイルだけページ(html)が生成される
// dest: 'assemble/',
// src: ['src/pages/**/*.hbs']
}
},
assemble: {
site: {
options: {
layoutdir: 'src/layouts', // 各ページのYFMで指定するレイアウトファイル(layout:)設置場所のパス
data: ['src/data/**/*.{json,yml}'], // 各hbsファイルから変数として呼び出すファイル群の指定
partials: ['src/includes/**/*.hbs'], // 各hbsファイルから呼び出すテンプレートhtml(.hbs)ファイルを指定
flatten: false, // true にすると、生成するファイル群からディレクトリパスを削除??
pages: grunt.file.readJSON('pages.json'), // 生成対象ページを json で指定。ディレクトリの指定ナシなので、Gruntfile.js と同階層
expand: true // option の設定を有効にするかどうか。
}
},
{
"en/s/trn/pf_hokkaido/index": { // ファイルの生成パス
"metadata": { // YFM に定義しておくのと同義になる??
"h1": "Station Search [XXXXXXXX] - Restaurant Guide in Hokkaido",
"canonical": "",
"description": "Station Search [XXXXXXXX] - Restaurant Guide in Hokkaido.Restaurant search by Cuisines and Location, Station, Budget, Discount, Features. XXXXXXXX is All you need to plan travel and meal to Japan.",
"keyword": "station,hokkaido,gourmet,restaurant,restaurant guide,japan restaurant guide,xxxxxxxx",
"photo": "/img/sp/area/hokkaido.jpg",
"prefcode": "01",
"lang": "en",
"layout": "list_trn.hbs"
},
"content": ""
},
"en/s/trn/pf_aomori/index": {
"metadata": {
"h1": "Station Search [XXXXXXXX] - Restaurant Guide in Aomori",
"canonical": "",
"description": "Station Search [XXXXXXXX] - Restaurant Guide in Aomori.Restaurant search by Cuisines and Location, Station, Budget, Discount, Features. XXXXXXXX is All you need to plan travel and meal to Japan.",
"keyword": "station,aomori,gourmet,restaurant,restaurant guide,japan restaurant guide,xxxxxxxx",
"photo": "",
"prefcode": "02",
"lang": "en",
"layout": "list_trn.hbs"
},
"content": ""
},
assemble: {
site: {
options: {
layoutdir: 'src/layouts', // 各ページのyamlFMで指定するレイアウトファイル(layout:)設置場所のパス
data: ['src/data/**/*.{json,yml}'], // 各hbsファイルから変数として呼び出すファイル群の指定
partials: ['src/includes/**/*.hbs'], // 各hbsファイルから呼び出すテンプレートhtml(.hbs)ファイルを指定
flatten: false, // true にすると、生成するファイル群からディレクトリパスを削除??
expand: true // option の設定を有効にするかどうか。
},
pages: {
files: {
'dev/': ['src/pages/**/*.hbs']
}
}
},
handlevars helpers > dates > now
- add timestamp as below.
$ npm i handlebars-helper-repeat --save
assemble: {
site: {
options: {
helpers: [
'handlebars-helper-repeat'
}
}
}
},
handlebars-helper-repeat@github
module.exports.register = function (Handlebars, options) {
Handlebars.registerHelper("xtimes", function(index_count, mod, block) {
if(parseInt(index_count) % (mod) === 0){
return block.fn(this);
}
});
};
assemble: {
site: {
options: {
helpers: [
'custom-helper.js'
}
}
}
},