skyrpex / laravel-nuxt-js

Build a SPA with Laravel and Nuxt.
https://www.npmjs.com/package/laravel-nuxt
MIT License
146 stars 20 forks source link

Great project - general questions / additions #16

Closed acidjazz closed 5 years ago

acidjazz commented 5 years ago

Great project! I use L+N for tons of projects and have two types of production servers so I'd like to look into and test/contribute to this setup since it provides a much simpler solution.

If you'd like to answer these here I can help update your docs and contribute with PR's:

I also forked this project and updated all the deps to use nuxtjs v2.3.4, working great so far!

skyrpex commented 5 years ago

Sorry for the late reply 🙏.

would it be possible to make the nuxt folder configurable? /resources/nuxt

Yes, you should be able to use the Nuxt's srcDir option without problem: https://nuxtjs.org/api/configuration-srcdir/

this doesn't install the boilerplate nuxt stuff, does @import in nuxt look in /resources/nuxt for everything else? components/ and state/ etc?

Yes, it looks for the usual Nuxt files inside the srcDir directory, which is resources/nuxt when using laravel-nuxt. I think now it's a bit confusing.

for deployment you said i can just npm run build , do i then just need to have nginx or apache run PHP on production setups? does the laravel package just proxy to the static pages?

After running npm run build, all of the static assets (js, css, images, etc) should be inside the public/_nuxt directory. It should work fine whether you use Apache, Nginx or something else using the default configuration.

how about we pass in and support dotenv then we can share the same .env for both nuxtjs and PHP, maybe allow support to put the nuxt folder in there?

This belongs to user land. You can use dotenv to load the variables and pass them to the frontend using the env property.

where exactly does all my other nuxt.config.js stuff go? same file? i just add the JS you stated in the readme?

You should pass it to the laravelNuxt method.

const laravelNuxt = require("laravel-nuxt");

module.exports = laravelNuxt({
    // All of your Nuxt config here.
});

This is confusing too, I know... I'd love to change the confusing parts in the v2, but I'm quite busy...

i wonder if a comment in the docs to add 2 space indentation for .js would help since thats most of the standards and installing laravel defaults to 4.

Not sure what the problem is. You can use eslint and editorconfig to standarize the indentation in your own project.

I also forked this project and updated all the deps to use nuxtjs v2.3.4, working great so far!

Glad it's working for you! You should be able to upgrade nuxt in your projects directly (without forking laravel-nuxt).

acidjazz commented 5 years ago

Thanks for the response @skyrpex , I actually hit a roadblock of some sort and started on my own boilerplate thats working well so far https://github.com/acidjazz/laranuxt

A bit more of a simpler setup, i just use the nuxtjs proxy module to route /api/ to laravel

I still am interested on how this project goes so I'll be looking for updates whenever you get time!