Closed PhilipHarney closed 5 years ago
hello, I'm working in ejs so maybe I'm offtopic (sorry), but if you want you can check https://github.com/matteo-bombelli/harp-ejs-functions
and looks in https://github.com/matteo-bombelli/harp-ejs-functions/blob/master/moduleSet/common/functions/lib/general.ejs
MB.general.ArrayToProps() function will do that:
<%
var current2 = MB.ArrayToProps(current.path, public);
for(i in current2.img._contents){
var image = current2[i]; %>
<img src="img/<%- image %>" />
<% } %>
but it's better to read my starting readme before...
If you know how to do it, you can convert it to jade (I am a frontend / php developer so ejs seems easier to me :) )
I'm putting together a site in Harp, using Jade templates, which will be composed of multiple topics, written by different contributors. Ideally, to make life easy for them, each contributor will only have to worry about a single folder: the one for their topic.
My present folder structure is something like this:
Each topic contains a sub-folder of images and I want to iterate over that folder, using the
_contents
element (outlined here). I have the desired Jade code functioning with an absolute path, such as:I feel it should be possible to do something like this:
And that seems like a useful feature for loads of scenarios. Apologies if it exists and I just couldn't find it.