-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide basedir or root option to allow absolute paths for includes #1
Comments
PS, I might have labeled this a bug instead if I had the option, but like I said, I don't know if this is really more an issue belonging to simple-pug-loader or what, all I know is they do provide the ability to pass the correct options object with the rules config, and everything is documented. This all began when I was unable to compile or serve with my includes like so:
For the files which contained those includes, the following error would return when attempting to compile:
This is the relevant piece of code for simple-pug-loader, index.js:
You can see how if no options are passed, basedir will be undefined. I do not have any idea where it goes from there to determine when basedir is actually required. Anyway, just more info for you. |
Hi @gerwintown, |
Feature Description
First of all, thank you for your work on this project. I am migrating from ng-cli-pug-loader (thanks to your helpful reply on one of its issue threads) following the upgrade to Angular 12 and think this implementation is very nice. I did run into one big issue however but it seems like it should be pretty easy to solve.
Pug allows the use of 'include" to import pug templates from elsewhere in the source code. It is very convenient to be able to use absolute paths, relative to the root or base of the project, for these includes.
The former solution, ng-cli-pug-loader, did allow this style for includes, my project relied on it heavily. Btw, this project also had some issues with pug includes, see below for more info on that.
The dependency simple-pug-loader allows this style as well, however you have to provide that value for the basedir or root option in the loader config:
I am not entirely sure if this is actually an issue with the simple-pug-loader dependency or what, but it seems modifying the loader rules created by ngx-pug-builder's util.js file takes care of the problem for me at least.
FYI, I also noticed that the former project, ng-cli-pug-loader, had some issues with includes, specifically with apply-loader per this issue, and this was their solution:
I'm not 100% clear on the why and how or if this even address the problem I am discussing or a different one, but hoping you know more than me, maybe you can make use of this information.
Let me know if there is anything else I can do, am interested to see how you think this should be addressed if at all.
Thanks again.
Use Case
I can keep my includes like so:
Instead of what would otherwise be a nightmare:
The text was updated successfully, but these errors were encountered: