Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Configuring the proxy server based on the directory name
Browse files Browse the repository at this point in the history
  • Loading branch information
ravenberg committed Jan 1, 2020
1 parent 9a31a0c commit 77c4b04
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Inertia React Laravel ui preset 💜
Leverage ReactJS as your view layer within Laravel. This is a
preset to setup [Inertia](https://inertiajs.com/) and [React](https://reactjs.org/) within a fresh Laravel installation. By using this, you get front-end scaffolding including authentication. Tailwind is setup as well.
Leverage ReactJS as your view layer within your Laravel application. This is a
preset to setup [Inertia](https://inertiajs.com/) + [React](https://reactjs.org/) within a fresh Laravel installation. By using this, you get front-end scaffolding including authentication. Tailwind is setup as well.

The benefit of using Inertia is how you are able to use Laravel and all its features while having a modern front-end along with that modern front-end development workflow;
The benefit of using Inertia is how you are able to use Laravel and all its beloved features while having a modern front-end along with that modern front-end development workflow;
```
$ npm run hot
```

> A proxy server is started with hot reloading. If you are not using Laravel Valet you may have to change the proxy url within your webpack.mix.js file.
## Setup
Follow these 3 steps to execute the scaffolding using this preset.
Expand Down
11 changes: 9 additions & 2 deletions src/InertiaReactPreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,18 @@ protected static function updateComposerArray(array $packages)
}

/**
* Override the webpack.mix.js file with the preset's one
* Override the webpack.mix.js file with the preset's one and configure it
*/
public static function configureMix()
{
File::copy(__DIR__.'/stubs/webpack.mix.js', base_path('webpack.mix.js'));
$webpackConfigBasePath = base_path('webpack.mix.js');
File::copy(__DIR__.'/stubs/webpack.mix.js', $webpackConfigBasePath);
$rootDirectoryName = Arr::last(explode('/', base_path()));
file_put_contents($webpackConfigBasePath, str_replace(
'laravel.test',
$rootDirectoryName . '.test',
file_get_contents($webpackConfigBasePath)
));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/InertiaReactPresetServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function boot()
PresetCommand::macro('inertia-react', function(Command $command) {
InertiaReactPreset::install($command);
$command->info('🎉 Inertiajs with Reactjs scaffolding complete.');
$command->info('ℹ️ Don\'t forget to run npm install && npm run dev');
$command->info('Don\'t forget to run npm install && npm run dev');
});
}
}

0 comments on commit 77c4b04

Please sign in to comment.