SR
Click to open github profile
Get Started

Installation

Learn how to install and configure the vue-craftcms package.


Requirements

  • The Craft Query API plugin must be installed and properly configured in Craft CMS.
  • Vue 3 is required.

Install

npm install -D vue-craftcms

You can register vue-craftcms Package with the craftcms property in your main.ts file.

main.ts
import { CraftCms } from '@vue-craftcms';
import { createApp } from 'vue';
import App from './App.vue';

const app = createApp(App);

// These are the default values
app.use(CraftCms, {
  baseUrl: '', // Required
  registerComponents: true,
  debug: false,
  enableEntryTypeMapping: true,
});

app.mount('#app');
  • baseUrl: refers to the PRIMARY_SITE_URL of Craft CMS, without a trailing slash.
  • debug: enables debug mode and log built urls
  • registerComponents: Globally register all components
  • enableEntryTypeMapping: This allows the CraftPage component to automatically detect your entries based on their section handle and entry type.

Boom, finished. 🚀


Copyright © 2024 Samuel Reichör