Skip to content
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

Files in 'hidden' directories are still rendered #12

Closed
SamBrishes opened this issue May 31, 2022 · 3 comments
Closed

Files in 'hidden' directories are still rendered #12

SamBrishes opened this issue May 31, 2022 · 3 comments

Comments

@SamBrishes
Copy link

SamBrishes commented May 31, 2022

Hello,

I ran into the issue that your extension also rendered files within a _* directory, and I guess that's an Windows only (with node.js v18.0.0) issue due to the path separator \ passed to globby. At least I could fix it by adding the path replacement regex, on the patterns, on the remaining 2 ones as well:

    const patterns = [
      this.from.path().replace(/\\/g, '/'),
      "!" + path.posix.join(this.base.replace(/\\/g, '/'), `**/_**/*`),
      "!" + path.posix.join(this.base.replace(/\\/g, '/'), `**/_*`),
    ];

I guess this should be better placed directly in the constructor, where this.base gets assigned.

Thanks for your extension.

@moyus
Copy link
Owner

moyus commented Jun 1, 2022

Cross platforms compatibility is really a pain in the ass 😂, I will fix it in the next release version.

@SamBrishes
Copy link
Author

SamBrishes commented Jun 1, 2022

That's true. ^^

Could you also change the glob value from

"!" + path.posix.join(this.base, `**/_**/*`)

to

"!" + path.posix.join(this.base, `**/_**/**/*`)

since then it would be possible creating folders in hidden directories without the need of another underscore on each sub-folder... Like the following structure:

_partials/
    page/
        ...
    content/
        ...
    macros/
        ...

Without the changed glob, the sub-folders are rendered (at least on Windows).


I also tried the front-matter header today, and noticed a small bug (?): I guess this line should be formatter.body instead of template, otherwise the whole front-matter content is passed to the resulting HTML file. (at least if you declare a layout value within the front-matter header... without that you just get the No layout declared in ... message in the console.)

@moyus
Copy link
Owner

moyus commented Jun 6, 2022

Fixed in v1.2.2

@moyus moyus closed this as completed Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants