Git Product home page Git Product logo

contenta_vue_nuxt's Introduction

Drupal 8 headless example with Contenta CMS / JSON API and Vue.js

!!! LOOKING FOR A NEW MAINTAINER !!! Please contact me or post an issue if you wish to contribute.

Build Status

Contenta Vue Nuxt is a Vue.JS front-end consumer example for Contenta CMS, pulling data from its Contenta public API example to build a fictive recipes site. You can see it live here : https://contentanuxt.now.sh/

This project helps you to start a decoupled Drupal 8 website with JSON API and Vue.js, with a concrete and simple example.

We strongly believe than a good headless Drupal has to be SEO-friendly and fast. That's why we are using the awesome Nuxt.js : Nuxt.js is just Vue.js with automatic Server Side Rendering and Code Splitting, so you don't have to deal yourself with all that stuff; and just enjoy your SEO-friendly site built with your Vue.js components.

vue image nuxt image

(vue drawing by https://twitter.com/hashedrock )

CONTRIBUTORS : WHAT OUR OBJECTIVES, WHY ARE WE DOING THIS ?

  1. Helping developers to start quickly a Drupal 8 headless with JSON API module or Contenta CMS.
  2. Mirror Vue.js values : un-opinionated, easy to read and learn. That's why we should avoid over-engineering to focus on keeping a low barrier to entry to Vue.js + Nuxt.js stack.
  3. This application MUST be SEO-friendly, because this is why Nuxt.js is used.
  4. Let's try to do something than can be easily forked to start your own D8 headless site.

GETTING STARTED

REQUIREMENTS

  • node v8.0.0 or >
  • npm 5 or >

INSTALL

# install dependencies
$ npm install

# serve with hot reload at localhost:3000
# service worker is disabled in dev
$ npm run dev

To listen on another port, edit your package.json and change dev script:

  # ...
  "scripts": {
    "dev": "PORT=5000 node_modules/.bin/nuxt"
  # ...

Run units tests

# run unit tests. test resides in test/unit directory
$ npm test

BUILD FOR PRODUCTION

# build for production
$ npm run build
# and launch production server
$ npm run start

How does it work ?

Most important parts of the code resides inside pages, components & layouts directories, this is where our Vue components resides.

Components are classic Vue.js single-file components.

Pages are special Nuxt.js components : they are automatically rendered on server side and are accessible automatically via an url. For example "pages/recipes.vue" can be accessed going to "/recipes" uri. They use a special "asyncData" method which is used for server side rendering.

Layouts are some Vue components used as template wrappers for pages components, somehow like the "page.tpl.php" from Drupal.

lib directory contains cross-components library or business logic, this is where resides our functions and class to fetch data from Contenta CMS public API.

DEV CONTRIBUTION GUIDELINES

see https://github.com/contentacms/contenta_vue_nuxt/wiki

contenta_vue_nuxt's People

Contributors

davidjor-hpan avatar e0ipso avatar jeanfei avatar nickstees avatar yann-yinn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.