Skip to content

Commit

Permalink
Merge pull request #12 from dcblogdev/feature/replace-webpack-with-vite
Browse files Browse the repository at this point in the history
Feature/replace webpack with vite
  • Loading branch information
dcblogdev authored Dec 23, 2022
2 parents 5a17e70 + 3ad8d12 commit 8745b0e
Show file tree
Hide file tree
Showing 23 changed files with 54 additions and 144 deletions.
24 changes: 0 additions & 24 deletions .env

This file was deleted.

10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,10 @@ composer update

>Ensure you've updated .env before migrating.
Migrate the database
Migrate and seed the database

```
php artisan migrate
```

Seed the database

```
php artisan db:seed
php artisan db:build
```

Link Storage to public
Expand Down
15 changes: 0 additions & 15 deletions changelog.md

This file was deleted.

35 changes: 0 additions & 35 deletions package.json

This file was deleted.

6 changes: 3 additions & 3 deletions src/AdminTwServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AdminTwServiceProvider extends ServiceProvider
*
* @return void
*/
public function register()
public function register(): void
{

}
Expand All @@ -22,7 +22,7 @@ public function register()
*
* @return void
*/
public function boot()
public function boot(): void
{
if (! $this->app->runningInConsole()) {
return;
Expand All @@ -38,7 +38,7 @@ public function boot()
*
* @return array
*/
public function provides()
public function provides(): array
{
return [Console\InstallCommand::class];
}
Expand Down
12 changes: 8 additions & 4 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class InstallCommand extends Command
*
* @return void
*/
public function handle()
public function handle(): void
{
//copy folders
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/app', base_path('app'));
Expand All @@ -37,18 +37,22 @@ public function handle()
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/stubs', base_path('stubs'));
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/tests', base_path('tests'));

// Tailwind / Webpack...
copy(__DIR__.'/../../stubs/composer.json', base_path('composer.json'));
copy(__DIR__.'/../../stubs/phpunit.xml', base_path('phpunit.xml'));
copy(__DIR__.'/../../stubs/package.json', base_path('package.json'));
copy(__DIR__.'/../../stubs/postcss.config.js', base_path('postcss.config.js'));
copy(__DIR__.'/../../stubs/tailwind.config.js', base_path('tailwind.config.js'));
copy(__DIR__.'/../../stubs/webpack.mix.js', base_path('webpack.mix.js'));
copy(__DIR__.'/../../stubs/vite.config.js', base_path('vite.config.js'));

if (file_exists(base_path('resources/views/welcome.blade.php'))) {
unlink(base_path('resources/views/welcome.blade.php'));
}

if (file_exists(base_path('resources/css/app.css'))) {
unlink(base_path('resources/css/app.css'));
}

$this->info('Admin theme installed successfully.');
$this->info('Please run "composer update" then "npm install && npm run dev" command to build your assets.');
$this->info('Please run "composer update" then "npm install && npm run build" command to build your assets.');
}
}
35 changes: 14 additions & 21 deletions stubs/package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"@tailwindcss/forms": "^0.4.0",
"@tailwindcss/typography": "^0.5.1",
"alpinejs": "^3.4.2",
"autoprefixer": "^10.1.0",
"@fortawesome/fontawesome-free": "^6.2.1",
"@tailwindcss/typography": "^0.5.8",
"alpinejs": "^3.10.5",
"autoprefixer": "^10.4.13",
"axios": "^0.25",
"laravel-mix": "^6.0.6",
"filepond": "^4.30.4",
"flatpickr": "^4.6.13",
"laravel-vite-plugin": "^0.7.2",
"lodash": "^4.17.19",
"postcss": "^8.2.1",
"postcss-import": "^14.0.1",
"sass": "^1.49.7",
"sass-loader": "^12.4.0",
"tailwindcss": "^3.0.0",
"filepond": "^4.25.1",
"flatpickr": "^4.6.9",
"prismjs": "^1.23.0",
"@fortawesome/fontawesome-free": "^6.0.0"
"postcss": "^8.4.20",
"tailwindcss": "^3.2.4",
"vite": "^4.0.0",
"prismjs": "^1.29.0",
"sass": "^1.57.1"
}
}
6 changes: 6 additions & 0 deletions stubs/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Binary file added stubs/public/webfonts/fa-brands-400.ttf
Binary file not shown.
Binary file added stubs/public/webfonts/fa-brands-400.woff2
Binary file not shown.
Binary file added stubs/public/webfonts/fa-regular-400.ttf
Binary file not shown.
Binary file added stubs/public/webfonts/fa-regular-400.woff2
Binary file not shown.
Binary file added stubs/public/webfonts/fa-solid-900.ttf
Binary file not shown.
Binary file added stubs/public/webfonts/fa-solid-900.woff2
Binary file not shown.
Binary file added stubs/public/webfonts/fa-v4compatibility.ttf
Binary file not shown.
Binary file added stubs/public/webfonts/fa-v4compatibility.woff2
Binary file not shown.
2 changes: 1 addition & 1 deletion stubs/resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as FilePond from 'filepond';
window.FilePond = FilePond;

import Prism from 'prismjs';
require('prismjs/plugins/normalize-whitespace/prism-normalize-whitespace');
import 'prismjs/plugins/normalize-whitespace/prism-normalize-whitespace';
import 'prismjs/themes/prism-tomorrow.css'; // see other themes in the prism docs
import 'prismjs/components/prism-markup-templating';
import 'prismjs/components/prism-php';
Expand Down
12 changes: 6 additions & 6 deletions stubs/resources/sass/app.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';

@import '~@fortawesome/fontawesome-free/css/all.css';
@import '~flatpickr/dist/flatpickr.css';
@import '~filepond/dist/filepond.min.css';
@import '@fortawesome/fontawesome-free/css/all.css';
@import 'flatpickr/dist/flatpickr.css';
@import 'filepond/dist/filepond.min.css';

@import 'components/alert';
@import 'components/button';
Expand Down
3 changes: 1 addition & 2 deletions stubs/resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>@yield('title') - {{ config('app.name', 'Laravel') }}</title>
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
@stack('styles')
<script src="{{ asset('js/app.js') }}" defer></script>
@stack('scripts')
<livewire:styles/>
<style>
Expand Down
3 changes: 1 addition & 2 deletions stubs/resources/views/layouts/guest.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
<script src="{{ mix('js/app.js') }}" defer></script>
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
</head>
<body>
<div class="font-sans text-gray-900">
Expand Down
3 changes: 1 addition & 2 deletions stubs/resources/views/layouts/plain.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
@stack('styles')
<script src="{{ mix('js/app.js') }}" defer></script>
@stack('scripts')
</head>
<body>
Expand Down
11 changes: 11 additions & 0 deletions stubs/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: ['resources/sass/app.scss', 'resources/js/app.js'],
refresh: true,
}),
],
});
21 changes: 0 additions & 21 deletions stubs/webpack.mix.js

This file was deleted.

0 comments on commit 8745b0e

Please sign in to comment.