-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Rewrite Module to support SSR rendering (#26)
- Loading branch information
1 parent
83e5989
commit 63ed29d
Showing
42 changed files
with
17,233 additions
and
37,855 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,4 @@ | ||
{ | ||
"extends": [ | ||
"@nuxtjs/eslint-config-typescript" | ||
], | ||
"rules": { | ||
"@typescript-eslint/no-unused-vars": [ | ||
"off" | ||
] | ||
} | ||
"root": true, | ||
"extends": ["@nuxt/eslint-config"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,25 @@ | ||
name: nodejs CI | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
branches: | ||
- main | ||
pull_request: | ||
branches: [main] | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
ci: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js 16.14.2 | ||
uses: actions/setup-node@v3 | ||
- uses: actions/checkout@v4 | ||
- run: corepack enable | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16.14.2 | ||
|
||
# Install locked dependencies and prepare types | ||
- run: npm ci | ||
- run: npm run dev:prepare | ||
|
||
# Check if build and package artifacts can still be generated | ||
- run: npm run prepack | ||
|
||
# Check linting and typing | ||
- run: npm run lint | ||
- run: npm run types | ||
node-version: 20 | ||
cache: "pnpm" | ||
|
||
# Check building | ||
- run: npm run build:module | ||
- run: npm run build:playground | ||
- run: pnpm install && pnpm dev:prepare | ||
- run: pnpm lint | ||
- run: pnpm build | ||
- run: pnpm dev:build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,9 @@ dist | |
# Nuxt | ||
.nuxt | ||
.output | ||
.data | ||
.vercel_build_output | ||
.build-* | ||
.env | ||
.netlify | ||
|
||
# Env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shamefully-hoist=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
imports.autoImport=false | ||
typescript.includeWorkspace=true | ||
# enable TypeScript bundler module resolution - https://www.typescriptlang.org/docs/handbook/modules/reference.html#bundler | ||
experimental.typescriptBundlerResolution=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
imports.autoImport=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
// @ts-ignore | ||
export default defineAppConfig({ | ||
docus: { | ||
title: 'My Docs' | ||
title: 'NuxtPDF docs' | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,53 @@ | ||
--- | ||
description: "Introduction to `nuxt-pdf` and its features for exporting html pages to pdf." | ||
description: "Introduction to `nuxt-pdf`." | ||
--- | ||
|
||
# Introduction | ||
|
||
`nuxt-pdf` is a Nuxt 3 wrapper around [jsPDF](https://github.com/parallax/jsPDF), a package that allows you to export PDF documents from your web apps. | ||
`nuxt-pdf` is an open source Nuxt 3 PDF toolkit, that allows you to easily render PDFs application or server side. | ||
|
||
::list{type="success"} | ||
- Adds built in Nuxt 3 support to export components to a PDF Document | ||
- Works with native Nuxt 3 refs, allowing you to keep your clean Nuxt 3 code free from any external package | ||
- Client side exporting of Vue components to HTML | ||
- Server side rendering of complex PDFs | ||
- Simple encryption of your PDFs, by allowing you to set a password and permissions | ||
- Editable forms inside your PDFs | ||
- Pre-build components to quickly develop your PDF | ||
- documentation, recipes and example code to get you started | ||
:: | ||
|
||
After installing the module you will be able to access the function like so: | ||
```ts | ||
// file: ~/app.vue | ||
import { exportToPDF } from '#imports' | ||
::callout | ||
#summary | ||
Show me the code! | ||
|
||
await exportToPDF('my-pdf-file.pdf', HTMLElement) | ||
``` | ||
#content | ||
Visit the [quick start](/nuxt-pdf/getting-started/quick-start) page to see code examples. | ||
:: | ||
|
||
## Which method is right for me? | ||
|
||
Generating PDFs on the client or through the server fundamentally change how the PDF is compiled and created. We try and ensure that our feature set matches both methods equally, however there are a few method-specific features. These are listed below. | ||
|
||
| | Application Side | Server Side | | ||
|-----------------------------------------------------|------------------|-------------| | ||
| **Features** | | | | ||
| Convert Vue components to PDFs | ✅ | ❌ | | ||
| Add Encryption to your PDFs | ✅ | ✅ | | ||
| Define Layouts for your PDFs | ❌ | ✅ | | ||
| Use your Tailwind Styles | ✅ | ❌ | | ||
| Use pre-build components to create your PDF | ❌ | ✅ | | ||
| Define your default PDF options in `nuxt.config.ts` | ❌ | ✅ | | ||
|
||
One factor that this table does not take into account is the reliablity and consistency, that server side generated PDFs will add to your application. Generating a PDF from HTML code, may result in different appearences, based on the browser, screen size and other settings on an individuals PC, limiting the control you have over the finished product. Rendering your PDFs on the server side, will allow you to control the output to a mich higher degree. | ||
|
||
### Use cases | ||
|
||
#### Application side | ||
|
||
- You need to quickly develop your PDF integration | ||
- You already have Vue components developed, that can be reused to generate the PDFs | ||
- You are not concerned about minor layout shifts and differences between browsers | ||
|
||
#### Server side | ||
|
||
See more in the [Quick Start section](/nuxt-pdf/getting-started/quick-start). | ||
- You require a higher degree of control over the output | ||
- You are developing complex PDFs that may require large amounts of data, you do not want to directly expose to a users client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.