VS Code / Cursor Enhancements for PocketPages
PocketPages includes some helpful VS Code configurations to improve your development experience. You can add these to your project by copying the .vscode
directory from the PocketPages starter files:
cp .vscode .vscode-backup
cp -r ./node_modules/pocketpages/starters/vscode .
Features
EJS Formatting
The configuration includes EJS Beautifier as the default formatter for HTML files. This ensures your EJS templates stay properly formatted.
To use:
- Install the EJS Beautifier extension
- Format your EJS files using
Alt+Shift+F
(Windows/Linux) orCmd+Shift+F
(Mac)
Code Snippets
Common PocketPages patterns are available as VS Code snippets:
ppld
Creates a new loader function with proper TypeScript types:
/** @type {import('pocketpages').PageDataLoaderFunc} */
module.exports = (api) => {
const { dbg } = api
dbg(new loader(), { api })
return {}
}
ppmd
Creates a new middleware function with proper TypeScript types:
/** @type {import('pocketpages').MiddlewareFunc} */
module.exports = (api) => {
const { dbg } = api
dbg(new loader(), { api })
return {}
}
To use snippets:
- Type the snippet prefix (e.g.,
ppld
) - Press
Tab
to insert the snippet - Use
Tab
to move between the customizable fields