laravel-nuxt-js

by skyrpex

Build a SPA with Laravel and Nuxt.

142 Stars 18 Forks Last release: about 1 year ago (v2.0.1) MIT License 108 Commits 23 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Warning: this project as been deprecated

laravel-nuxt
was created to offer some sugar when working locally with Laravel+Nuxt, solving some cookie problems in the process. Today, it isn't necessary anymore.

We recommend using Laravel Sanctum, which plays nicely with SPAs (see Sanctum's SPA Authentication section). If you can't migrate, just keep using

laravel-nuxt
.

Laravel Nuxt JS

TravisCI Build status

This package allows you to build a SPA with Laravel and Nuxt.

I'm currently very busy so don't expect updates anytime soon. Please, check out m2sd/nuxt-laravel which is based on this repository but it's more active.

Installation

npm install laravel-nuxt

Attention! You must install the laravel-nuxt PHP package first.

Getting Started

Optionally, you will want to get rid of the default Laravel scaffolding.

Add a script to your

package.json
like this:
{
    "scripts": {
        "start": "laravel-nuxt"
    },
}

Wrap you

nuxt.config.js
's export with
laravelNuxt
:
const laravelNuxt = require("laravel-nuxt");

module.exports = laravelNuxt({ // Your Nuxt options here... modules: [], plugins: [],

// Options such as mode, srcDir and generate.dir are already handled for you. });

Populate

resources/nuxt/pages/index.vue
inside your project:

And then run:

npm start

Go to http://localhost:8000.

Commands

Development

laravel-nuxt dev

Starts both Nuxt and Laravel artisan servers in development mode (hot-module reloading, error reporting, etc).

Production

laravel-nuxt build

Compiles the application for production deployment.

This command will output the compiled assets in

public/_nuxt
.

Analysis

laravel-nuxt build -a

Launch

webpack-bundle-analyzer
to optimize your bundles.

Other

Getting rid of the default Laravel scaffolding

The default Laravel installation comes with some frontend files which are not needed anymore.

You can remove the following files and directories:

  • resources/assets/
  • package.json
  • package-lock.json
  • webpack.mix.js

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.