How do I define a basedir in Jade using only Prepros to compile templates?

StackOverflow https://stackoverflow.com/questions/21095579

  •  27-09-2022
  •  | 
  •  

سؤال

I'm using Jade without Node, I'm simply using the software Prepros to compile the templates to static HTML.

I want to include partials that are outside of the folder the Jade templates are in, like so:

include /partials/foo.html

However, using paths that begin with a / with include in Prepros gives the following error:

the "basedir" option is required to use "include" with "absolute" paths

Usually you could set the basedir using something like app.locals.basedir = __dirname + '/views', but there's no way to do this with Prepros. Is there some other way?

هل كانت مفيدة؟

المحلول

It is security restriction imposed by jade language. I have added a workaround in Prepros Jade compiler to fix this issue, fix will be available from the next version of Prepros.

نصائح أخرى

You can just deleted / and it will works.

You also can add the path in the root folder and just call it like foot.html.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top