GithubHelp home page GithubHelp logo

spatie / laravel-server-side-rendering-examples Goto Github PK

View Code? Open in Web Editor NEW
104.0 104.0 29.0 404 KB

Example app for https://github.com/spatie/laravel-server-side-rendering

Home Page: https://sebastiandedeyne.com/posts/2018/server-side-rendering-javascript-from-php

License: MIT License

PHP 89.69% Vue 3.22% Shell 0.68% Blade 6.41%

laravel-server-side-rendering-examples's Introduction

Example implementations of our laravel-server-side rendering package

This repo contains examples of server-side rendered JavaScript SPAs rendered in a Laravel application using our home grown spatie/laravel-server-side-rendering package.

We've got a a vue + vuex + vue-router example and a very basic react + react-router example that will be expanded in the future.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the app locally like you'd install any other Laravel app.

git clone [email protected]:spatie/laravel-server-side-rendering-examples.git
composer install
yarn
yarn production

If you want to see server side rendering in action, set your .env file's APP_ENV key to production.

Credits

License

The MIT License (MIT). Please see License File for more information.

laravel-server-side-rendering-examples's People

Contributors

adrianmrn avatar alexandcote avatar dependabot[bot] avatar freekmurze avatar riasvdv avatar sebastiandedeyne avatar

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

laravel-server-side-rendering-examples's Issues

ssr storage folder

Hi, i have clone you repo for experimental use. But there is a problem.

The tmp_path would not be set. Also the folder. Default they goes to storage/app/ssr but if this folder doesn't exist, the app is throwing an exception on production mode.

I hope you understand what i mean, my english is not the best :D

Kind regards

Target class [] does not exist

When calling ssr('js/entry-server.js') getting this error

Illuminate\Contracts\Container\BindingResolutionException
Target class [] does not exist. (View: /path/to/project/resources/views/layouts/my.blade.php)

nuxtjs SSR

It is possible to make this package work with nuxtjs SSR ? Maybe someone already did it ?

The command "node ..." failed

I launched a project and set in my .env
NODE_PATH=node
APP_ENV=production

But I have this error:

The command "node W:\OSPanel\domains\example\storage\app/ssr\342a336ef63a6e8f23f78828aec4b37a.js" failed. Exit Code: 1(General error) Working directory: W:\OSPanel\domains\example\public Output: ================ Error Output: ================ "node" �� ���� ����७��� ��� ���譥� ��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���. (View: W:\OSPanel\domains\example\resources\views\vue.blade.php)

Tell me please what can I do. Thank in advance

Eliminate zero problem

hi!
Excuse me, where did the packages.json file come from?
This package has another one nested in it. It looks strange。

fetch data before render

I wanna fetch data before render in react not from php/laravel. It's a good thing to fetch data ( from API-database) before render but it does not work.

Parse error: syntax error, unexpected '='

Hello, I am using react and laravel for server-side-rendering.

  • Laravel Mix Version:- 1.0

  • React Version:- 16.2.0

  • PHP Version:- 7.0

  • What I did?
    I clone your repo and then I tried to run it on my C9 workspace. I am also having another project of mine for the server-side-rendering. Both are shoiwing the same error on running.

  • Error

/home/ubuntu/workspace/vendor/spatie/laravel-server-side-rendering/src/Resolvers/MixResolver.php
 
namespace Spatie\Ssr\Resolvers;
 
class MixResolver
{
    /** @var bool */
    protected $enabled;
 
    public function __construct(bool $enabled)
    {
        $this->enabled = $enabled;
    }
 
    public function __invoke(string $identifier) : string
    {
        if (! $this->enabled) {
            return $identifier;
        }
 
        [$publicPathWithoutQuery] = explode('?', $identifier);
 
        return public_path($publicPathWithoutQuery);
    }
}
 
Arguments
"Parse error: syntax error, unexpected '='"
Exception message: Parse error: syntax error, unexpected '='
ErrorException (E_ERROR)
Parse error: syntax error, unexpected '=' (View: /home/ubuntu/workspace/resources/views/vue.blade.php)
  • Actually I am testing server-side-rending for SEO for my project but I am unable to test it. I took help from your repo but your repo is also coming up with this error. I appreciate your effort. I would be grateful to you if you can help me in this.

Thank you so much.

Node cannot be inserted at the specified point in the hierarchy

Hi
I'm facing with a weird problem when editing App.vue file.
"Node cannot be inserted at the specified point in the hierarchy"
It happens just by removing 'router-link' tag!!
How can I fix it?
This is what I want:

<template>
    <div id="app">
        <router-view />
    </div>
</template>

The Mix manifest does not exist

Hello, I follow the steps, but getting this error on vue and react path.
"The Mix manifest does not exist. (View: E:\Proyectos\Php\Laravel\laravel-server-side-rendering-examples\resources\views\vue.blade.php)"
"The Mix manifest does not exist. (View: E:\Proyectos\Php\Laravel\laravel-server-side-rendering-examples\resources\views\react.blade.php)"

vue meta and css framework

hi,how i can use vue meta and css framework aka materialize-css ,when it use document param?
ty for answer

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.