nuxtjs-drupal-ce
Easily connect Nuxt.js to Drupal via custom elements.
Pre-requisites
- A Drupal backend with the Lupus Custom Elements Renderer module installed.
Setup
- Add
nuxtjs-drupal-cedependency to your Nuxt.js project
yarn add nuxtjs-drupal-ce # or npm install nuxtjs-drupal-ce- Add
nuxtjs-drupal-ceto themodulessection ofnuxt.config.js
{
modules: [
// Simple usage
'nuxtjs-drupal-ce',
// With options
['nuxtjs-drupal-ce', {
baseURL: 'https://your-drupal.example.com'
}]
]
}- Get started quickly by scaffolding initial files:
$(npm bin)/nuxt-drupal-ce-initYou may also take a look at the example project.
Options
-
baseURL: The Drupal base URL. May be overridden by an environment variableDRUPAL_BASE_URLif set. Defaults to http://localhost:8888'. -
addRequestFormat: If set totrue, the_format=custom_elementsURL parameter is added automatically to requests. Defaults totrue. -
addRequestContentFormat: If specified, the given value is added as_content_formatURL parameter to requests. Disabled by default. -
addVueCompiler: If enabled, the Vue compiler is added to the runtime build. This is necessary if you want to render custom elements markup on runtime. Defaults totrue. -
useProxy: If set todev-onlyand nuxt is in dev-mode, the module automatically configures/apito the Drupal backend via @nuxtjs/proxy and uses it instead of the Drupal backend, such that there are no CORS issues. Other values supported arealwaysor false. -
axios: Options to pass-through to thedrupal-ceaxios instance.
Development
- Clone this repository
- Install dependencies using
yarn installornpm install - Start development server using
npm run dev
Testing
Run npm run test or yarn test.
License
Credits
Development sponsored by drunomics hello@drunomics.com