2.0.2 • Published 2 years ago

vite-plugin-sheets v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vite-plugin-sheets

Relaces %sheets.<sheet>.<slot>% with content.

Useful when using Google Sheets as CMS. Spreadsheet must be shared with the service account.

Check out the Sheets API to get started. You must have a Google Cloud Project with the "Sheets API" enabled.

:warning: Warning
Only loads sheets data once per build, this is to save API calls. Therefore changes made to the sheets during development will not be displayed until restarting the dev server.

Required Options

Other Options

  • slotColumn: Defaults to 0. Which column to look use as slots.
  • contentColumn: Defaults to 1. Same as slotColumn but for the content.
  • ignore: Defaults to true. Weather or not to treat row 1 as a header column.

Sample Config

export default {
  plugins: [
    sheets({
      creds: "creds.json",
      spreadsheetId: process.env.SPREADSHEET_ID
    })
  ]
}

Sample Sheet Setup

"Home" Sheet

SlotContent
titleAwesome Title
contentCool content

"About" Sheet

SlotContent
titleAbout Us
somethingOther stuff

The header row gets ignored by default.

  • title in the "Home" sheet would be mapped to %sheets.home.title%
  • content in the "Home" sheet would be mapped to %sheets.home.content%
  • title in the "About" sheet would be mapped to %sheets.about.title%
  • something in the "About" sheet would be mapped to %sheets.about.something%
2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago