pure180 / gulp-pug-inheritance

Gulp plugin to rebuild jade files and all files that have extended or included those files
11 stars 7 forks source link

Pug inheritance only recognizes absolute paths from basedir #8

Open davidperis92 opened 5 years ago

davidperis92 commented 5 years ago

Let's say you project structure is like this: | bases | _base.pug | includes | _include.pug | index.pug

if you extend '_base.pug' from 'index.pug' and in '_base.pug' you include the file '_include.pug' like this:

// bases/_base.pug
include /includes/_include.pug

//index.pug
extends bases/_base.pug

when you modify the file '_include.pug' the changes won't be reflected because PugInheritance starts searching inside 'bases/' so the route that is taking is 'bases/includes/_include.pug'.

To solve this you must use absolute routes ever:

// bases/_base.pug
include /includes/_include.pug

//index.pug
extends /bases/_base.pug  // Notice the '/' put before the route to file

Then the path to the include inside '_base.pug' will be '/includes_include.pug' which is the right path to file.