2

From docs:

If no file extension is given, .pug is automatically appended to the file name.

However, I need to include a system file without extension:

include .browserslistrc

Pug tries to include .browserslistrc.pug, not .browserslistrc. How can I include this file without creating a symbolic link?

  • You can't. Pug only includes .pug files, as the docs indicate. – Graham Feb 12 '19 at 15:00
  • 1
    @Graham pug may include files as plain text: https://pugjs.org/language/includes.html#including-plain-text – Сергей Козлов Feb 13 '19 at 10:13
  • Then it looks like you have found a bug, probably best to report it on the github issues page and delete this question. – Graham Feb 13 '19 at 11:45
  • @Graham it's a good question and may help future SO users with the same question—why delete? – Sean Feb 14 '19 at 00:59
  • Because it can't be answered. See this (and dozens of other meta discussions): https://meta.stackoverflow.com/questions/346666/has-sos-attitude-towards-bug-reports-changed – Graham Feb 14 '19 at 05:52
  • @Graham I will try to report it as a bug. But now the question seems to me relevant. In addition, the question contains a solution, albeit not the best (creating a symbolic link with any extension). – Сергей Козлов Feb 14 '19 at 07:02
  • Up to you in the end, if you feel that creating the symbolic link is the answer then you should go ahead and post it as an answer so this question is flagged as having a solution. You may also want to add some more descriptive text to the title such as "no extension" – Graham Feb 14 '19 at 11:06
  • issue: https://github.com/pugjs/pug/issues/3116 – Сергей Козлов Feb 21 '19 at 07:25

1 Answers1

0

Solution option (possibly suitable only for Unix-like systems):

You can create a symbolic link to a file without an extension by adding an any extension. Example:

ln -s .browserslistrc .browserslistrc.txt

Windows also supports symbolic links, but I have not tested this solution there. Probably, this solution will not be cross-platform.