Code Monkey home page Code Monkey logo

wuxt's Introduction

Wuxt logo

Nuxt/WordPress development environment - Wuxt

Wuxt combines WordPress, the worlds biggest CMS with nuxt.js, the most awesome front-end application framework yet.

Quick start

git clone https://github.com/northosts/wuxt.git
cd wuxt
docker-compose up -d

Introduction

The goal of Wuxt is to provide a ready to use development environment, which makes the full power of WordPress easily available to your front-end app. Included in Wuxt are:

  • Fully dockerized WordPress and nuxt.js container configuration, docker-compose up -d sets up everything needed in one command and you can start working

  • Extended Rest API to give the front-end easy access to meta-fields, featured media menus or the front-page configuration.

  • The newest nuxt.js version, extended with a WordPress $wp object, to connect to the extended WordPress Rest API.

All together the Wuxt features get you started with your front-end with just one command, you just need to work with the intuitive WordPress admin interface and can skip all back-end coding. But if you know your way around WordPress you are able to easily extend the back-end as well.

WUXT environment

First clone this repository to a directory you want, then change to that directory and simply start your containers (you need to have a running Docker installation of course):

docker-compose up -d

That starts the following containers:

  • MySql (mysql.wuxt) Database for your WordPress installation. The data-folder of the database-container is mirrored to the _db-folder of your host system, to keep the data persistent.

  • WordPress (wp.wuxt) on a Apache server with the newest PHP version and the Wuxt Rest API extension theme, ACF and other good-to-have plugins pre-installed. The wp-content directory of the WordPress directory is mirrored to the wp-content directory on your host.

  • nuxt.js (front.wuxt) started in development mode with file-monitoring and browser-sync and extended by a complete WordPress Rest API wrapper and a starter application, mimicing base functions of a WordPress theme.

Your containers are available at

  • front-end: http://localhost:3000
  • back-end: http://localhost:3080, http://localhost:3080/wp-admin
  • database: docker exec -ti mysql.wuxt bash

wuxt allows you to change the above setup to run multiple projects at the same time or to adjust to your own environment. To change ports and container names, add an .env file in the same directory of your docker-compose.yml file. You can adjust the following values:

WUXT_PORT_FRONTEND=3000
WUXT_PORT_BACKEND=3080
WUXT_PORT_DIST=8080
WUXT_MYSQL_CONTAINER=mysql.wuxt
WUXT_WP_CONTAINER=wp.wuxt
WUXT_NUXT_CONTAINER=front.wuxt

After you created the file, run

docker-compose down
docker-compose up -d

There is even a script that does everything to you :

npm run env

You will be asked for projectname, front-end-port, back-end-port and dist-port. The script creates an .env file like the folllowing and stops the old containers:

WUXT_PORT_FRONTEND=4000
WUXT_PORT_BACKEND=4080
WUXT_PORT_DIST=9080
WUXT_MYSQL_CONTAINER=mysql.projectname
WUXT_WP_CONTAINER=wp.projectname
WUXT_NUXT_CONTAINER=front.projectname

After running the script start the new containers

docker-compose up -d

In short:

  • Install WordPress (http://localhost:3080/install.php)
  • Set permalinks to Post name (http://localhost:3080/wp-admin/options-permalink.php)
  • Activate wuxt-theme (http://localhost:3080/wp-admin/themes.php)

Do a common WordPress installation at http://localhost:3080/install.php, then login to wp-admin and select the wuxt theme to activate all the API extensions. Additionally you might want to activate the ACF plugin to make your meta-value work easier. Last but not least you have to set the permalink structure to "Post Name" in the WordPress settings.

To check if everything is running, visit http://localhost:3080 and verify that the wuxt info screen is showing.

Then check that the Rest API at http://localhost:3080/wp-json is returning a JSON-object you are good to go.

Nuxt should have been started automatically inside the docker container. The command we use for running the nuxt.js server is yarn dev. Check if the front-end is running by opening http://localhost:3000. You should be greeted by the Wuxt intro-screen.

Check if BrowserSync is running, by doing a minor change to the front-page. The change should directly be visible on the front-page without manually reloading the page.

To make a complete deploy of WUXT, you have to get at least one server and solve a lot of configuration stuff to get WordPress, MySql and nuxt.js running (we are working on a manual for some of the big cloud services).

However, there is an easier solution, at least without on-site user generated content, like WordPress-comments (disqus would be ok, though). We have tweaked the nuxt.js generate-command, so that you can generate a fully static site with all your content, posts and pages inside the dist directory of nuxt. Then it's only a matter of getting the static html-site uploaded to a webspace of your choice.

First be sure your containers are running

docker-compose up -d

Then go to the wuxt root-directory and run generate with yarn

yarn generate

Despite generating your static site, this commands runs some docker-compose action, so while generating, your WUXT site will be down and started again after.

After the generation there will be started a small local web-server, which deploys the static site on

http://localhost:8080

To get the files you go to the dist directory inside your wuxt/nuxt directory:

wuxt/nuxt/dist

To shut down the local web-server you have to run the following command insie the wuxt directory:

docker-compose -f dist.yml down

How it works

The generate-command simply scrapes all available urls you added to your nuxt.js and WordPress installation, saves the html-output and caches the JSON-requests to the WordPress Rest API.

To know which urls are available, the generate command asks the WordPress Rest API for a list of existing endpoints and all links used in the WordPress menus. You can view that list with the following endpoint:

GET: /wp-json/wuxt/v1/generate

Since nuxt.js doesn't fully support 100% static sites yet, we have to get help of the static plugin used on nuxt.org, which is jsut taking care of the payload caching. Read more here and here.

WordPress Rest API endpoints

The WordPress Rest API gives you access to a wide range of native endpoints. Find the docs at: https://developer.wordpress.org/rest-api/reference/. To easily access the endpoints from nuxt.js you can use the $wp extension, which integrates the node-wpapi library. You can find the full documentation here.

Extensions to the API endpoints

To make wuxt even more easy to use, there are a bunch of endpoint extensions to the WordPress Rest API.

$wp.frontPage()
$wp.frontPage().embed()

or

GET: /wp-json/wuxt/v1/front-page
GET: /wp-json/wuxt/v1/front-page?_embed

You can use the WordPress front-page settings to build your front-ends first page. If you setup the front-page in WordPress as static page, the endpoint will return the corresponing page object.

If there is no front-page configured, the query automatically returns the result of the default posts query

GET /wp-json/wp/v2/posts

Note that the _embed parameter works for the front-page query, which gives you access to featured media (post-thumbnails), author information and more.

$wp.menu()
$wp.menu().location(<location>)

or

GET: /wp-json/wuxt/v1/menu
GET: /wp-json/wuxt/v1/menu?location=<location>

The WordPress Rest API is not providing an endpoint for menus by default, so we added one. We have also registered a standard menu with the location main, which is returned as complete menu-tree, when you request the endpoint without parameters.

Don't forget to create a menu and adding it to a location in wp-admin when you want to use this endpoint.

If you want to use multiple menus, you can request them by providing the menu location to the endpoint.

$wp.slug().name('<post-or-page-slug>')
$wp.slug().name('<post-or-page-slug>').embed()

or

GET: /wp-json/wuxt/v1/slug/<post-or-page-slug>
GET: /wp-json/wuxt/v1/slug/<post-or-page-slug>?_embed

The WordPress Rest API is not providing an endpoint to get posts or pages by slug. That doesn't mirror the WordPress theme default behaviour, where the url-slug can point to both a page or a post.

With the slug endpoint we add that function, which is first looking for a post with the given slug and then for a page. The embed parameter is working for the slug endpoint.

The WordPress Rest API does not include meta fields in the post objects by default. For two of the most common plugins, ACF and Yoast WordPress SEO, we have automatically added the values of these fields. They are located in the meta section of the response objects.

Taxonomy queries are limited of the simple WordPress Rest API url structure. Especially with filtering queries, we struggled with the missing relation parameter in queries for posts by taxonomy. We added this feature with a new parameter to the WordPress API:

GET: /wp-json/wp/v2/posts/?categories=1,2&and=true

Note: Setting the relation to "and" will cause all taxonomy queries to use it. Right now you cant query one taxonomy with "and" and another with "or".

In Nuxt you just have to use the "and" param after a post query for categories.

$wp.posts().categories([1,2]).param('and', true)

If your application has to get posts by geographical proximity, you can use the geo parameters.

GET /wp-json/wp/v2/posts/?coordinates=<lat>,<lng>&distance=<distance>

The coordinates parameter has to contain lat and lng, comma-separated and each value can be prefixed with the meta-key if has to be compared with (default keys: lat, lng). The distance is calculated in kilometers, postfix the value with m for miles. Some example queries:

 GET /wp-json/wp/v2/posts/?coordinates=52.585,13.373&distance=10
 GET /wp-json/wp/v2/posts/?coordinates=lat_mkey:52.585,lng_mkey:13.373&distance=10
 GET /wp-json/wp/v2/posts/?coordinates=52.585,13.373&distance=10m

The WordPress Rest API is providing endpoints for custom post types, as long as they are registered the right way (see the Scaffolding section for generating cpt-definitions).

To make querying of your custom post types as easy as everything else, we added the cpt method to the $wp object. See post type queries for a fictional 'Movies' post type, below

$wp.cpt('movies')
$wp.cpt('movies').id( 7 )

The cpt function returns cpt-objects similar to the posts() or pages() queries, meta fields are included.

To help you with some of the common tasks in wuxt, we integrated a bunch of npm scripts. Just install the needed packages in the root directory and you are ready to run.

npm install

Working with Docker is awesome, but has some drawbacks. One of them is that you have to make some changes from inside the container. To enter the WUXT containers, you can use the following npm scripts:

npm run enter:mysql
npm run enter:wp
npm run enter:front

You exit a container with exit.

Two of the most common tasks are managing WordPress and installing new packages in the front-end.

WUXT provides you with the full power of the WP-CLI tool. Check out all documentation at https://developer.wordpress.org/cli/commands/. To run any WP-CLI command inside the wp.wuxt container, just use the following npm-script:

npm run wp <wp-cli-command>

Examples: npm run wp plugin list, npm run wp plugin install advanced-custom-fields, npm run wp user create wuxt [email protected]

The same concept we use for yarn in the front container:

npm run yarn <yarn-command>

Example: npm run yarn add nuxt-webfontloader

The commands are checking if the containers are running and installing needed dependencies automatically. So if WP-CLI is not installed in the container it will be installed before running a wp command.

Scaffolding

WUXT allows you to generate custom post types and taxonomies via npm scripts. You can pass needed parameters as arguments. If you don't pass arguments, you will get prompted.

Scaffolding a post type

npm run scaffold:cpt <name>

# Examples:
npm run scaffold:cpt
npm run scaffold:cpt Movie

The custom post type definition is copied into the cpts folder of the wuxt theme and loaded automatically by the theme.

To query the new post-type you can use the cpt method of the wuxt $wp object.

Scaffolding a taxonomy

npm run scaffold:tax <name> <post-types>

# Examples:
npm run scaffold:tax
npm run scaffold:tax Venue event,cafe

The taxonomy definition is copied into the taxonomies folder of the wuxt theme and loaded automatically by the theme.

WUXT Headless WordPress API Extensions: Plugin which includes all our API extensions.

Nuxt + WordPress = WUXT: Introduction post for WUXT.

Credits

@yashha for the excelent idea with the $wp object, first implemented in https://github.com/yashha/wp-nuxt

wuxt's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wuxt's Issues

Documentation about how to get custom post type meta to the API

When you make a new custom post type, and want it and its ACF & Yoast meta fields to show in the API you have to:

  1. Support custom fields in the post type:
    'supports' => array('custom-fields')
  2. Support rest in the post type:
    'show_in_rest' => true
  3. Make the wuxt_register_acf_meta() register meta for the new post type as well:
    register_post_meta('recommendation', $field['name'], array('show_in_rest' => true));
  4. Do the same in the wuxt_register_yoast_meta():
    register_post_meta('recommendation', $field, array('show_in_rest' => true));
  5. Add stuff to the nuxt/modules/wp-api/plugin.js:
    import registerRecommendation from '~/modules/wp-api/routes/recommendation'
  6. Add more stuff to the same file:
    registerRecommendation(wp)
  7. Make a new file nuxt/modules/wp-api/routes/recommendation.js:
export default wp =>
  (wp.recommendation = wp.registerRoute('wp/v2', '/recommendation/(?P<id>)', {
    params: ['embed']
  }))

Maybe this can be simplified somehow, but at least it needs to be documented. ๐Ÿค“

Getting "ERR_EMPTY_RESPONSE" on http://localhost:3000/

After booting up docker, I get the error: "ERR_EMPTY_RESPONSE"

image

I experienced the error after dowing and then upping the docker server. I didn't change anything, and it just happened out of the blue.

I managed to get the page back, after messing around with yarn install and yarn run dev inside the /nuxt/ folder, but after downing the server again ( to change Docker resources ), now after booting up again, I can't access the front end.

I have no other browsersync/etc running on port 3000 atm. I can access the WordPress backend without any issues.

Can't find the database

I installed the docker image, but can't install Wordpress on http://localhost:3080/ The other pages (eg. http://localhost:3080/wp-admin/themes.php ) give me this error screen
image
I think it has some problem with the database, but don't know what could be the problem. I checked the Terminal and it seems the mysql server is also running
Creating wp.wuxt ... done
Creating mysql.wuxt ... done
Creating front.wuxt ... done

I can see the Wuxt open page at http://localhost:3000/ though.
Using macOS High Sierra.

Thanks for the help, waiting eagerly to work on the Wuxt Development :-)

i18n filter - &lang=en

Hi everybody,

I start using wuxt for a production website but I need to use it with multilanguage.
I install polylang-pro and it has a language filter in api rest, for example:
/wp-json/wp/v2/posts?lang=en

I try this kind of filter with wuxt custom routes calling it in nuxt with .slug('xxx').params('lang', 'en'), but it doesn't work.
I'm looking into wuxt wordpress plugin that exposes api, but I'm not a php/wordpress expert and I cannot undestand how to implement it.

Can someone help me?

Very slow development environment

When using the /wp-admin/ on a fresh install, it's okay speed. But as soon as you start to install some plugins (WPML, WooCommerce, etc) the speed slows down alot.

Even using the wp-rest api, will take a few seconds to respond.

I have tested out, using a different, yet popular, docker image: https://github.com/visiblevc/wordpress-starter

It's blazingly fast.

My suggestion is: Let's base wuxt on the setup that visiblevc/wordpress-starter has. I think this would create a much faster and more pleasant development environment.

Heres a comparrsion.

Using northosts/wuxt docker:

image

Using visiblevc/wordpress-starter docker:

image

I found the library through this SO question, and the answer explains why visblevs/wordpress-starter might be so fast: https://stackoverflow.com/questions/54291859/docker-wordpress-super-slow

Menus end point claims menu location doesn't exist

Just installed the WUXT plugin in a fresh install of wordpress. Setup and applied a menu to my one menu location defined in functions.php but the WUXT rest end point claims the menu doesn't exist.

I feel like there is likely an extra step I need to take but its not clear what that is. Particularly since all of the other end points are working perfectly.

Any reason the menu end point would claim no menu location exists when one is clearly defined and assigned in wordpress?

if i want to use JWT Authentication, where should i put my JWT_AUTH_SECRET_KEY ?

i wanted to use JWT authentication with wuxt but i have this error.
{"code":"rest_no_route","message":"No route was found matching the URL and request method.","data":{"status":404}}

i think is because wnuxt didt need a wp-config file but i manually create one and pu the JWT_AUTH but it didt detect it, how should i make this work ? anyone tried

i am follow this post
https://hashinteractive.com/blog/headless-wordpress-jwt-vue-authentication/

Nuxt-Link broken

I have been working on a site and created a navbar that uses Nuxt Links to navigate between pages.
It was working 100% and I am not sure if anything has changed, I just rebuilt the containers.
For some reason the links for nuxt-link is now creating a link to http://wp.wuxt/wp-json/wuxt/v1/slug/about etc

When it wasn't doing this before?

Deploy ssr app

Hi guys, there's a way to deploy a ssr app?

How do you deploy production?
Because Wordpress needs a webhook if you want to generate everytime a static website.

I need a deploy solution that doesn't need coding skills for update content.
Maybe a full docker machine with nuxt build && nuxt start instead of nuxt?

Menus

Hi there,

Thanks again for this brilliant starter kit.

I'm having some trouble working with the menus, and I wanted to know if you had any example code from your Nuxt app that you can share that would produce a nav menu? Particularly in the sense of preserving the correct ordering via the menu_order key.

It doesn't seem to be very straight forward to work this, so I'm hoping you guys can provide something in your example app to help get off the ground with it quickly.

Multisite support?

This is a great project but I have no idea where the wp-config.php lives so not sure how to piece together multisite.

Overloaded?

Hello!

I run 6 instances od Wuxt on my Linux server (i try to make Wuxt to be CMS like for managing content, which will be staticaly served). I run 6 containers and when they all run, after some time randomly in one of two of them just crashed:

test3-front.wuxt | โœ” Builder initialized
test3-front.wuxt | โœ” Nuxt files generated
test3-front.wuxt | Browserslist: caniuse-lite is outdated. Please run next command yarn upgrade
test3-front.wuxt | โ„น Compiling Client
test3-front.wuxt | โ„น Compiling Server
test3-front.wuxt | (node:68) DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks instead
test3-front.wuxt | โœ” Server: Compiled successfully in 9.99s
test3-front.wuxt | โœ” Client: Compiled successfully in 11.92s
test3-front.wuxt | โ„น Waiting for file changes
test3-front.wuxt |
test3-front.wuxt | READY Server listening on http://0.0.0.0:3000
test3-front.wuxt |
test3-front.wuxt | [nodemon] app crashed - waiting for file changes before starting...

Do anyone know what could be the reason for that? Thankx!

/sample-page not found

When trying to access http://0.0.0.0:3000/sample-page the front.wuxt container responds with a 404 error.

Steps to reproduce:

  1. clone the repository
  2. docker-compose up
  3. click the "sample page" link

This issue persists after completing the wordpress installation at localhost:3080

Getting post image

I'm trying to set-up a Post with the fetched post-image, but as I see it needs another request for it, through the link which is available at
this.post._links['wp:featuredmedia'][0].href
but this object is only available after the post itself was loaded. Is there any other way to get the image (src link) parallel with the post content?

Install webpack loaders for pre-processors

I think, by default these libs & loaders should be installed on the node container, so one can use lang="scss" on style tags in vue components:

yarn add node-sass sass-loader -D

Read more in Nuxt docs

If i run it in ./nuxt to mirror it to the container everything stops working. For me, I had to SSH into the node container, install it, and then restart docker to get it working.

ACF Options page

Hi there,

How can I get the ACF options page information? For instance; I store my WordPress menu there, and need to fetch it on every page.

yarn generate assumes "front.wuxt" instead of .env values

I created a custom name for my app in .env, called "front.jwr" instead of "front.wuxt", but when running yarn generate it fails with error:

yarn run v1.17.3
$ docker exec front.wuxt yarn generate && docker-compose --log-level CRITICAL -f dist.yml up -d && docker-compose --log-level CRITICAL -f dist.yml restart && docker-compose --log-level CRITICAL down && docker-compose --log-level CRITICAL up -d
Error: No such container: front.wuxt
error Command failed with exit code 1.

Getting cross links from the Wordpress installation

I have a difficulty to make the nav menu work with the fetched json data and nuxt-link (but possibly this is a question for building the navigation for the whole site)
My problem is that the links that are fetched from the wp json are different domain, and hence the nux-link appends it to the a href. Or am I doing something wrongly?
The code:

      <nav class="header__nav">
        <nuxt-link v-for="menu in menus" :key="menu.id" :to="{ path: menu.url }" >
            {{ menu.title }}
        </nuxt-link>
      </nav>

...

<script>

const hostAdress = "http://localhost:3080";

import Logo from '~/components/Logo'

export default {
  components: {   Logo  },
  data() {
    return { menus: [] }
  },
  mounted() {
    fetch(hostAdress + '/wp-json/wuxt/v1/menu')
    .then(response => {
      response.json().then(menus => {
        this.menus = menus;
      })
    })
  }

}
</script>

On the output I get
image

Thank you in advance and big thanks for making this framework! (a bit of Wiki/FAQ would be very-very nice though ;-) )

HTTPS / SSL support

I notice the code in functions.php includes references to https://localhost:3000/ but I notice I cannot access the site using https. How can I enable local SSL for the site?

Live reload not working

Hi!
I installed wuxt, started docker-compose up.

After I changed nuxt/components/templates/Page.vue nothing happened!

WooCommerce

Hi, have this been tested with WooCommerce? I am considering using wuxt for a WordPress site with 2500 products, and curious to know what the authors / people think of this in relation to this library?

manifests for arm missing

I'm trying to set this up on my raspberry pi4, but when running docker-compose, I get:

5.7: Pulling from library/mysql
ERROR: no matching manifest for linux/arm64/v8 in the manifest list entries

Error: Cannot find module 'dotenv'

I am trying to scaffold a custom post type with npm run scaffold:cpt <cpt name> command.

I am making sure to set up the .env file in the same main directory as docker-compose.yml as mentioned in the guide. I tried both options :

a) docker-compose down before creating .env manually followed by `docker-compose up -d.

b) using npm run env

However both ways gives me Error: Cannot find module 'dotenv'.

Is there anything I am missing? Thanks.

front.wuxt won't run and wuxt theme in wordpress not showing up

Hi all,

I'm using windows sublinux system and the windows version of docker.

I had no problem installing wuxt by following the quick start instructions.
git clone https://github.com/northosts/wuxt.git

cd wuxt
docker-compose up -d
http://localhost:3080/install.php - Install WordPress
http://localhost:3080/wp-admin/options-permalink.php - Set permalinks to Post name
http://localhost:3080/wp-admin/themes.php - Activate wuxt-theme
http://localhost:3000 - Done

When everything finishes preparing, wp.nuxt and mysql.nuxt containers run but front.wuxt had an issue saying "info No lockfile found." and
"error Couldn't find a package.json file in "/var/www/app"
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command."

this means I can't access the front end using localhost:3000

Also I couldn't activate wuxt-theme as it's not there when I visit /themes.php

Would anyone be able to help. I remember using wuxt on a full linux system without any issues but when I tried with WSL yesterday I experienced this issue.

Thank you!

How can I update the wordpress?

How can I update the WordPress to version 5 or higher and if I can change the design of the page since I am using the wuxt theme?

Possible to template wp-content for all projects

Is it possible to use a templated wp-content for multiple projects?
I understand .env can be updated, but this is within a single project. I'm wondering if it's possible to still have separate project files but have a core wp-content folder? Use case for having multiple project folders: the use of child themes and different custom plugins.

Setting up the frontend

I got the Wuxt development server up and running - great.

Now I need to start writing components and setting up the frontend. As far as I can see, theres no documentation on this. I guess I simply need to setup a webpack config, including Vue2, babel etc, or is there some specific recommended approach to this?

ACF Repeater

Hi everybody

Someone of you can help me on adding Repeater type fields on rest api?
This code, found on your api plugin:

function nuxt_register_acf_meta() {
    if ( function_exists( 'acf_get_field_groups' ) ) {

        $result = array();
        $acf_field_groups = acf_get_field_groups();

        foreach( $acf_field_groups as $acf_field_group) {
            foreach($acf_field_group['location'] as $group_locations) {
                foreach($group_locations as $rule) {
                    foreach(acf_get_fields( $acf_field_group ) as $field) {
                        register_meta('post', $field['name'], array( 'show_in_rest' => true ) );
                    }
                }
            }
        }
    }
}

cannot show repeater fields, because they're nested I think.

ESLint complaining about template tags <%= %>

Hi there,

ESLint is saying it cannot compile the template tags like this:

// https://github.com/northosts/wuxt/blob/master/nuxt/modules/wp-api/plugin.js
const wp = new WPApi(<%= serialize(options) %>);

I can't seem to find a solution to this online. How did you set this to work?

Browser sync not working with docker container

I'm trying to get my webpage to update on file changes with browser sync, but it doesn't work. The only way I can get the page to change according to my updates is by restarting the Docker container. Is there a known way of getting this to work?

It takes forever to install any frontend package with yarn.

Hi there,

I've been trying to use this boilerplate all day and I've followed the readme instructions. I have the project running and i'm trying to add in front end libraries that I want to use with my project and it's taking forever to install them.

Why is it so slow and is there any quick fix?
This took more than 10 minutes to install on an i7 macbook pro 8gb running mojave
I've ran other docker projects before and never had this problem with prehistoric install times

Thanks

yarn add v1.15.2
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "nuxt-buefy > [email protected]" has unmet peer dependency "vue@^2.6.11".
warning "@nuxtjs/vuetify > [email protected]" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning "@nuxtjs/vuetify > [email protected]" has unmet peer dependency "vue@^2.6.4".
warning "@nuxtjs/vuetify > [email protected]" has unmet peer dependency "vue-template-compiler@^2.6.10".
warning "@nuxtjs/vuetify > [email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "@nuxtjs/vuetify > vuetify-loader > [email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning " > [email protected]" has incorrect peer dependency "eslint@>=6.2.2".
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".```

Question regarding deployment

Hey guys, probably very noobie question so sorry for that.
Im not sure where should I put my wordpress domain address when Im deploying my app so nuxt knows from where he can fetch the data.
Which file and variable is it?

Thanks for help!

WP_Debug / wp-config

Where do I customize the wp-config.php? I am currently experincing some errors, and the page is just white.

Incompatible with vuetify ?

Hey there, I tried to add vuetify to use in the nuxt folder but it seems to not be compatible, keeps crashing on docker-compose up with a Python error (I have it installed on my ubuntu machine)

asyncData not working?

I want to rewrite the working .fetch function to asyncData (to store the pages on the server), but it somehow doesn't work. I tried with the dummy json palceholder for now, but it doesn't return anything. Any idea why?

export default {

async asyncData({ $axios }) {
  const data = await $axios.$get('https://jsonplaceholder.typicode.com/todos/1')
  faketitle = this.data.title;
},

components: {
    Logo
  },
  data() {
    return { 
      menus: [],
      hostAdress: hostAdress,
      faketitle: ''
      }
  },
  mounted() { 
    fetch(hostAdress + '/wp-json/wuxt/v1/menu')
    .then(response => {
      response.json().then(menus => {
        this.menus = menus;
      })
    })
  }

}

Origin is not allowed by Access-Control-Allow-Origin

All the containers are running. Followed the tutorial and applied wuxt theme, enabled post. When I go to the frontend http://localhost:3000/sample-page it shows

Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc. An error occurred while rendering the page. Check developer tools console for details.

When I look at the console, it says:
Access to XMLHttpRequest at 'http://localhost:3080/wp-json/wuxt/v1/slug/sample-page' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

sample-page:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)

image

New Fetch API

New Fetch API doesn't seem to work here? What dependencies should we update? I saw that the version on the nuxt folder is on 2.9.2 while the latest nuxt version is only on 2.13.3? Can you point me on the right directions

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.