/ / Assemble.io problém s použitím alternatívnych šablón získanie 0 stránok zostavených - zurb-foundation, yeoman-generator, assemble

Assemble.io problém s použitím alternatívnych šablón získanie 0 stránok zostavených - zurb-foundation, yeoman-generator, assemble

Som nový pre Assemble.io a používam generátor na rýchle nastavenie pre nadáciu 5. Mám však problém s jeho použitím pomocou alternatívnych šablón.

Môžem získať stránku, aby vygenerovala všetky stránky s rovnakou šablónou, ale radšej by mala samozrejme mať iné šablóny pre časti stránky.

Aktuálne Gruntfile.js

assemble : {
options : {
layoutdir : "<%= paths.templates %>/layouts",
layout : "site.hbs",
partials : "<%= paths.templates %>/partials/*.hbs",
assets : "<%= paths.assets %>",
data : "<%= paths.data %>/*.{json,yml}",
helpers : [ "<%= paths.templates %>/helpers/*.js" ],
marked : {gfm : true},
plugins : [ "assemble-middleware-sitemap","assemble-contrib-permalinks" ],
sitemap : {dest : "<%= paths.dist %>/"},
permalinks : {preset : "pretty"},
},
about: {
// override task-level layout
options: {
layoutdir : "<%= paths.templates %>/layouts",
layout: "banded.hbs",
partials : "<%= paths.templates %>/partials/*.hbs",
assets : "<%= paths.assets %>",
data : "<%= paths.data %>/*.{json,yml}",
helpers : [ "<%= paths.templates %>/helpers/*.js" ],
marked : {gfm : true},
plugins : [ "assemble-middleware-sitemap","assemble-contrib-permalinks" ],
sitemap : {dest : "<%= paths.dist %>/"},
permalinks : {preset : "pretty"}
},
// files: {"docs/": ["src/content/about/*.hbs" ]},
files : [ {
expand : true,
cwd : "<%= paths.content %>/about",
src : "<%= paths.content %>/about/*.{md,hbs}",
dest : "<%= paths.dist %>/"
} ]
},

// Default
dist : {
files : [ {
expand : true,
cwd : "<%= paths.content %>/",
src : "**/*.{md,hbs}",
dest : "<%= paths.dist %>/"
} ]
}
},

Keďže som veľmi nováčikom, skúšal som niekoľko vecí a pozrel som sa na dokumentáciu na lokalite Assemble.io, ale nezdá sa, že by tu pomohla.

Príklad z lokality Assemble.io.

assemble: {
options: {
layout: "default.hbs",
layoutdir: "layouts"
},
docs: {
// override task-level layout
options: {layout: "docs-layout.hbs" },
files: {"docs/": ["src/docs/*.hbs" ]},
},
site: {
// override task-level layout
options: {layout: "site-layout.hbs" },
files: {"site/": ["src/site/*.hbs" ]},
}
// ... other targets
}

Tak ako som spomenul predtým, ako bola vytvorená základná stránka nadácie Yoeman a ja ju používam generátorom sassy-roboyeti tak som sa nechcel odbočiť ďaleko od toho, čo nastavuje v predvolenom nastavení.

Akékoľvek nápady by boli veľmi ocenené.

odpovede:

0 pre odpoveď č. 1

Nie je to práve odpoveď, ale našla som alternatívnu metódu.

Namiesto toho, aby každá sekcia používala rozloženie, pridávam, aké rozloženie má súbor použiť pre každý jednotlivý súbor HTML. Myslím, že je to oveľa jednoduchšie.

Aktualizované Gruntfile.js

"use strict";
module.exports = function(grunt) {
require("time-grunt")(grunt);

grunt
.initConfig({

paths : {
src : "src",
dist : "dist",
tmp : ".tmp",
assets : "<%= paths.dist %>/assets",
content : "<%= paths.src %>/content",
data : "<%= paths.src %>/data",
templates : "<%= paths.src %>/templates",
bower : "bower_components"
},

//credentials: grunt.file.readJSON("credentials.json"),

watch : {
assemble : {
files : [ "<%= paths.src %>/{content,data,templates}/**/*.{md,hbs,yml,json}" ],
tasks : [ "assemble" ]
},
sass : {
files : [ "<%= paths.src %>/css/**/*.scss" ],
tasks : [ "sass:server" ]
},
js : {
files : [ "<%= paths.src %>/js/**/*.js" ],
tasks : [ "concurrent:js" ]
},
livereload : {
options : {
livereload : "<%= connect.options.livereload %>"
},
files : [ "<%= paths.dist %>/**/*.html",
"<%= paths.assets %>/css/{,*/}*.css",
"<%= paths.assets %>/js/{,*/}*.js",
"<%= paths.assets %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}" ]
}
},

connect : {
options : {
port : 9000,
livereload : 35729,
// change this to "0.0.0.0" to access the server from outside
hostname : "localhost"
},
dist : {
options : {
open : true,
base : [ "<%= paths.dist %>" ]
}
}
},

assemble : {
options : {
layoutdir : "<%= paths.templates %>/layouts",
//layout : "site.hbs",
partials : "<%= paths.templates %>/partials/*.hbs",
assets : "<%= paths.assets %>",
data : "<%= paths.data %>/*.{json,yml}",
helpers : [ "<%= paths.templates %>/helpers/*.js" ],
marked : {gfm : true},
plugins : [ "assemble-middleware-sitemap","assemble-contrib-permalinks" ],
sitemap : {dest : "<%= paths.dist %>/"},
permalinks : {preset : "pretty"},
},
//Default
dist : {
files : [ {
expand : true,
cwd : "<%= paths.content %>/",
src : "**/*.{md,hbs}",
dest : "<%= paths.dist %>/"
} ]
}
},

imagemin : {
images : {
files : [ {
expand : true,
cwd : "<%= paths.content %>/images/",
src : "**/*.{png,jpg,gif}",
dest : "<%= paths.assets %>/images/"
} ]
}
},

modernizr : {
dist : {
devFile : "<%= paths.bower %>/modernizr/modernizr.js",
outputFile : "<%= paths.assets %>/js/modernizr.js"
}
},

sass : {
options : {
includePaths : [ "<%= paths.bower %>" ]
},
dist : {
options : {
outputStyle : "compressed"
},
files : {
"<%= paths.assets %>/css/site.css" : "<%= paths.src %>/css/site.scss"
}
},
server : {
options : {
sourceMap : true
},
files : {
"<%= paths.assets %>/css/site.css" : "<%= paths.src %>/css/site.scss"
}
}
},

concurrent : {
js : [ "copy:bower", "copy:js", "modernizr" ],
assets : [ "copy:bower", "copy:js", "modernizr", "imagemin" ]
},

clean : {
dist : "<%= paths.dist %>/**",
tmp : "<%= paths.tmp %>",
bowerAssets : "<%= paths.dist %>/bower_components",
js : [ "<%= paths.assets %>/js/*",
"!<%= paths.assets %>/js/modernizr.js" ]
},

useminPrepare : {
home : "<%= paths.dist %>/index.html",
options : {
dest : "<%= paths.dist %>"
}
},

filerev : {
css : {
src : "<%= paths.assets %>/css/*.css"
},
js : {
src : "<%= paths.assets %>/js/*.js"
}
},

usemin : {
html : [ "<%= paths.dist %>/**/*.html" ]
},

copy : {
bower : {
files : [ {
expand : true,
cwd : "<%= paths.bower %>/",
src : [ "jquery/**", "foundation/**" ],
dest : "<%= paths.dist %>/bower_components/"
} ]
},
js : {
files : [ {
expand : true,
cwd : "<%= paths.src %>/js/",
src : [ "*.js" ],
dest : "<%= paths.assets %>/js/"
} ]
}
},

cdnify : {
dist : {
html : [ "<%= paths.dist %>/**/*.html" ]
}
},

htmlmin : {
dist : {
options : {
removeComments : true,
collapseWhitespace : true
},
files : [ {
expand : true,
cwd : "<%= paths.dist %>/",
src : "**/*.html",
dest : "<%= paths.dist %>"
} ]
}
}
});

grunt.loadNpmTasks("assemble");
require("load-grunt-tasks")(grunt);

grunt.registerTask("build:dist", [ "clean:dist", "clean:tmp", "assemble",
"concurrent:assets", "sass:dist", "useminPrepare", "concat",
"clean:js", "uglify", "filerev", "usemin", "cdnify", "htmlmin",
"clean:bowerAssets" ]);

grunt.registerTask("build:server", [ "clean:dist", "clean:tmp", "assemble",
"concurrent:assets", "sass:server" ]);

grunt.registerTask("server", [ "build:server", "connect", "watch" ]);

grunt.registerTask("default", [ "build:dist" ]);
};

Teraz v mojom /about/index.hbs


názov: O popis: Toto je moja stránka.

rozloženie: banded.hbs

Ahoj, toto je asi stránka.