Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude paths in Pug?

Tags:

html

pug

I'm trying exclude paths in Pug, that should not be among compiled files in dist folder, but nothig help!.

I renamed dir parts to _parts, parts/footer.pug to _parts/_footer.pug, but I still see compiled files in dist/_parts/ dir.

So, how can exclude some paths in Pug. (I use pug-cli as compiler)?

like image 715
Kiazim Khutaba Avatar asked Oct 26 '25 06:10

Kiazim Khutaba


1 Answers

Yes it's possible with bash And if you're on Windows, you can use git bash You just need to prefix the ignored file with "_"

So, suppose your project directory looks like this:-

  • my-project/
    • index.html
    • pugjs
      • _head.pug
      • index.pug

you can do:-

pug -w "$(ls ./pugjs/!(_*))" -o ./

Now what does this line do? basically, the "$(ls ./pugjs/!(*))" lists all files that don't have the prefix "" they get passed as files paths argument to pug

like image 178
Aybak3k Avatar answered Oct 28 '25 22:10

Aybak3k



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!