SnowdogApps / vuepress-plugin-pdf-export

Vuepress plugin for exporting as PDF without system wide dependencies suitable for headless environments
MIT License
29 stars 7 forks source link

feat: Add option to exclude pages #3

Open JosuaMeier opened 4 years ago

JosuaMeier commented 4 years ago

Would be nice to have the option to exclude pages from output file.

aporan commented 4 years ago

@JosuaMeier hiya, another fellow plugin user here. Although adding it here would be nice, but i figured out the same result by using patterns in vuepress config:

  patterns: process.env.EXPORT_PDF === 'True' ? ['**/*.md', '**/*.vue', '!**/openapi.md', "!*/index.md", "!index.md"] :  ['**/*.md', '**/*.vue'],
JosuaMeier commented 4 years ago

@aporan Thx for your response.

If I use the your pattern snippet, its not working. process.env.EXPORT_PDF is undefined. Where do I have to provide this variable. If it is as easy as you mentioned, I would surely prefer your solution.

Sorry, I am very new on the VuePress topic. (1 day) 🙈

aporan commented 4 years ago

Hi,

It's just an environment variable I'm defining in cli. You ca remove that and use the first array. Ofcourse, depending on your use case, you've to tweak the file types. Mine won't work directly.

The second array in the ternary operator is the default value vuepress uses.

On Wed, Jul 8, 2020, 8:08 PM Josua Meier notifications@github.com wrote:

@aporan https://github.com/aporan Thx for your response.

If I use the your pattern snippet, its not working. process.env.EXPORT_PDF is undefined. Where do I have to provide this variable. If it is as easy as you mentioned, I would surely prefer your solution.

Sorry, I am very new on the VuePress topic. (1 day) 🙈

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SnowdogApps/vuepress-plugin-pdf-export/pull/3#issuecomment-655478502, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2IX32SUGWZXI7FRE3Q6JDR2ROURANCNFSM4OUIRUWA .

JosuaMeier commented 4 years ago

@aporan Yeah, works perfectly. No need for this pull request. Thank you.

Igloczek commented 4 years ago

Hi, thanks for this contribution! I'll open this PR to keep in mind to add this feature, because I need it too. Currently, since I'm building sidebar links programmatically, I'm filtering pages here, so including it into the plugin itself will be nicer.

markmcdowell commented 3 years ago

FYI, I didn't really want to have to create an env. variable so i did this instead:

patterns: process.argv.includes("export") ? ["**/api/**/*.md", '**/*.vue'] : ['**/*.md', '**/*.vue']