Giter Site home page Giter Site logo

curzey / nuxt-headless Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bovas85/nuxt-headless

0.0 1.0 0.0 17.51 MB

Nuxt headless using WordPress REST API

Home Page: https://medium.com/@moustachedesign/creating-a-website-with-nuxt-js-and-wordpress-rest-api-51cf66599cf3

License: MIT License

JavaScript 26.20% CSS 8.68% Vue 0.40% PHP 64.52% SCSS 0.21%

nuxt-headless's Introduction

Nuxt Headless

Greenkeeper badge Build Status libera manifesto

Nuxt + WordPress REST API boilerplate

Changes

[ 1.2.0 ]

  • 4 - November - 2020
    • Nuxt updated to latest 2.14.7
    • Updated most dependencies for security bumps

[ 1.2.0 ]

  • 15 - June - 2019
    • Nuxt updated to v2.8.1
    • Updated LazyImage for better lazy loading
    • Added Defer mixin

[ 1.1.0 ]

  • 21 - March - 2019
    • Nuxt updated to v2.5
    • Added postcss-nested
    • added more docs and comments

Use in production?

Please note this is a boilerplate, it contains some defaults you might want to pay attention to:

  • CORS - You should set this to work only on your website url when in production or staging, work locally on your machine for dev.
  • Plugins and Theme, most of these can be removed, but you'll need ACF (free version is OK) to make it work.

Installation Steps

  1. Copy the contents of the /wordpress folder in your wordpress installation (make sure to edit wp-config.php)

  2. Make sure you activate all the plugins and set Moustache Design as your active theme in wordpress (you can rename it if you want)

  3. Set permalinks in wordpress to anything but the default (I suggest /%postname%/)

  4. Make sure you set your CORS correctly to point to your website when in production/staging

  5. Make sure assets/config.js reflects your configuration and endpoints for the WP rest api and wordpress url

  6. You can edit all the files and config freely. This is MIT licensed, but credit is welcome.

Check how I used this in my blog at https://medium.com/@moustachedesign/creating-a-website-with-nuxt-js-and-wordpress-rest-api-51cf66599cf3

Vuex config

The current config allows to either initialise the api calls in nuxtServerInit, or commit fetch mutations from each page. You can otherwise skip Vuex and load the data for each page using asyncData.

Build Setup

# install dependencies
$ yarn # Or npm install

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

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

# generate static project
$ yarn generate # or npm run generate

Hosting

I suggest now for SSR websites using nodeJS, or Netlify for static sites (free hosting) using yarn generate

You can of course use this as middleware following Nuxt Docs below.

Nuxt Docs

For detailed explanation on how things work with Nuxt, checkout the Nuxt.js docs.

How to contribute

All PRs are very welcome and much needed. Steps to contribute:

  • Fork development branch
  • Make your changes
  • Make a PR
  • PR is either approved or sent back
  • If PR is approved I'll include it in the next release

nuxt-headless's People

Contributors

bovas85 avatar greenkeeper[bot] avatar dependabot[bot] avatar snyk-bot avatar yusadolat avatar

Watchers

James Cloos 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.