├── .gitignore
├── LICENSE.md
├── README.md
├── composer.json
├── screenshots
├── dashboard.png
├── login.png
├── pagination-simple.png
├── pagination.png
├── register.png
├── reset-password-email.png
├── reset-password.png
└── verify.png
├── src
├── LaravelPresetServiceProvider.php
└── Preset.php
└── stubs
├── controllers
└── HomeController.stub
├── resources
├── css
│ └── app.css
└── views
│ ├── auth
│ ├── login.blade.php
│ ├── passwords
│ │ ├── confirm.blade.php
│ │ ├── email.blade.php
│ │ └── reset.blade.php
│ ├── register.blade.php
│ └── verify.blade.php
│ ├── home.blade.php
│ ├── layouts
│ └── app.blade.php
│ └── vendor
│ └── pagination
│ ├── default.blade.php
│ └── simple-default.blade.php
├── tailwind.config.js
└── webpack.mix.js
/.gitignore:
--------------------------------------------------------------------------------
1 | /.idea
2 | /vendor
3 | composer.lock
4 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Tailwindcomponents
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Laravel preset for TailwindCSS
2 |
3 | [](//packagist.org/packages/tailwindcomponents/laravel-preset)
4 | [](//packagist.org/packages/tailwindcomponents/laravel-preset)
5 | [](//packagist.org/packages/tailwindcomponents/laravel-preset)
6 | [](//packagist.org/packages/tailwindcomponents/laravel-preset)
7 |
8 |
9 |
10 |
11 | 🛹 A Laravel front-end scaffolding preset for [Tailwind CSS](https://tailwindcss.com) - a Utility-First CSS Framework for Rapid UI Development.
12 |
13 | ## Installation and usage
14 | This package requires Laravel 7.0 or higher.
15 |
16 | 1. Fresh install Laravel and `cd` to your app.
17 | 2. Install `composer require tailwindcomponents/laravel-preset --dev`.
18 |
19 | ### a. Preset WITHOUT Authentication
20 |
21 | 1. Use `php artisan ui tailwindcss` for the basic Tailwind CSS preset.
22 | 2. `npm install && npm run dev`
23 | 3. `php artisan serve` (or equivalent) to run server and test preset.
24 |
25 | ### b. Preset WITH Authentication
26 |
27 | 1. Use `php artisan ui tailwindcss --auth` for the basic preset, auth route entry, and Tailwind CSS auth views in one go. (NOTE: If you run this command several times, be sure to clean up the duplicate Auth entries in `routes/web.php`)
28 | 4. `npm install && npm run dev`
29 | 5. Configure your favorite database (mysql, sqlite etc.)
30 | 6. `php artisan migrate` to create basic user tables.
31 | 7. `php artisan serve` (or equivalent) to run server and test preset.
32 |
33 | ### Config
34 |
35 | The default `tailwind.config.js` configuration file included by this package simply uses the config from the Tailwind vendor files. Should you wish to make changes, you should remove the file and run `node_modules/.bin/tailwind init`, which will generate a fresh configuration file for you, which you are free to change to suit your needs.
36 |
37 | ## Screenshots
38 |
39 | 
40 |
41 | 
42 |
43 | 
44 |
45 | 
46 |
47 | 
48 |
49 | 
50 |
51 | 
52 |
53 | 
54 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tailwindcomponents/laravel-preset",
3 | "description": "Laravel frontend preset for Tailwind CSS",
4 | "keywords": ["laravel", "preset", "tailwindcss"],
5 | "license": "MIT",
6 | "require": {
7 | "laravel/framework": "^7.0|^8.0",
8 | "laravel/ui": "^2.0|^3.0"
9 | },
10 | "autoload": {
11 | "psr-4": {
12 | "TailwindComponents\\LaravelPreset\\": "src/"
13 | }
14 | },
15 | "extra": {
16 | "laravel": {
17 | "providers": [
18 | "TailwindComponents\\LaravelPreset\\LaravelPresetServiceProvider"
19 | ]
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/screenshots/dashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tailwindcomponents/laravel-preset/4e2aa8719e4f22e8a867cce046b924928fbbc830/screenshots/dashboard.png
--------------------------------------------------------------------------------
/screenshots/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tailwindcomponents/laravel-preset/4e2aa8719e4f22e8a867cce046b924928fbbc830/screenshots/login.png
--------------------------------------------------------------------------------
/screenshots/pagination-simple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tailwindcomponents/laravel-preset/4e2aa8719e4f22e8a867cce046b924928fbbc830/screenshots/pagination-simple.png
--------------------------------------------------------------------------------
/screenshots/pagination.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tailwindcomponents/laravel-preset/4e2aa8719e4f22e8a867cce046b924928fbbc830/screenshots/pagination.png
--------------------------------------------------------------------------------
/screenshots/register.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tailwindcomponents/laravel-preset/4e2aa8719e4f22e8a867cce046b924928fbbc830/screenshots/register.png
--------------------------------------------------------------------------------
/screenshots/reset-password-email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tailwindcomponents/laravel-preset/4e2aa8719e4f22e8a867cce046b924928fbbc830/screenshots/reset-password-email.png
--------------------------------------------------------------------------------
/screenshots/reset-password.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tailwindcomponents/laravel-preset/4e2aa8719e4f22e8a867cce046b924928fbbc830/screenshots/reset-password.png
--------------------------------------------------------------------------------
/screenshots/verify.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tailwindcomponents/laravel-preset/4e2aa8719e4f22e8a867cce046b924928fbbc830/screenshots/verify.png
--------------------------------------------------------------------------------
/src/LaravelPresetServiceProvider.php:
--------------------------------------------------------------------------------
1 | info('Tailwind CSS scaffolding installed successfully.');
18 |
19 | if ($command->option('auth')) {
20 | Preset::installAuth();
21 |
22 | $command->info('Tailwind CSS auth scaffolding installed successfully.');
23 | }
24 |
25 | $command->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.');
26 | });
27 |
28 | Paginator::defaultView('pagination::default');
29 | Paginator::defaultView('pagination::simple-default');
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Preset.php:
--------------------------------------------------------------------------------
1 | '^0.2.1',
15 | 'tailwindcss' => '^2.0.2',
16 | 'autoprefixer' => '^10.2.1',
17 | 'vue' => '^2.6.11',
18 | 'vue-template-compiler' => '^2.6.11',
19 | 'vue-loader'=> '^15.9.5',
20 | ];
21 |
22 | public static function install()
23 | {
24 | static::updatePackages();
25 | static::updateStyles();
26 | static::updateBootstrapping();
27 | static::removeNodeModules();
28 | static::updatePagination();
29 | }
30 |
31 | public static function installAuth()
32 | {
33 | static::scaffoldController();
34 | static::scaffoldMigrations();
35 | static::scaffoldAuth();
36 | static::scaffoldAuthViews();
37 | }
38 |
39 | protected static function updatePackageArray($packages)
40 | {
41 | return array_merge(
42 | static::NPM_PACKAGES_TO_ADD,
43 | $packages
44 | );
45 | }
46 |
47 | protected static function updateStyles()
48 | {
49 | tap(new Filesystem, function ($filesystem) {
50 | $filesystem->delete(public_path('css/app.css'));
51 |
52 | if (! $filesystem->isDirectory($directory = resource_path('css'))) {
53 | $filesystem->makeDirectory($directory, 0755, true);
54 | }
55 | });
56 |
57 | copy(__DIR__.'/../stubs/resources/css/app.css', resource_path('css/app.css'));
58 | }
59 |
60 | protected static function updateBootstrapping()
61 | {
62 | copy(__DIR__.'/../stubs/tailwind.config.js', base_path('tailwind.config.js'));
63 |
64 | copy(__DIR__.'/../stubs/webpack.mix.js', base_path('webpack.mix.js'));
65 | }
66 |
67 |
68 | protected static function scaffoldController()
69 | {
70 | if (! is_dir($directory = app_path('Http/Controllers/Auth'))) {
71 | mkdir($directory, 0755, true);
72 | }
73 |
74 | $filesystem = new Filesystem;
75 |
76 | collect($filesystem->allFiles(base_path('vendor/laravel/ui/stubs/Auth')))
77 | ->each(function (SplFileInfo $file) use ($filesystem) {
78 | $filesystem->copy(
79 | $file->getPathname(),
80 | app_path('Http/Controllers/Auth/'.Str::replaceLast('.stub', '.php', $file->getFilename()))
81 | );
82 | });
83 | }
84 |
85 | protected static function scaffoldMigrations()
86 | {
87 | $filesystem = new Filesystem;
88 |
89 | collect($filesystem->allFiles(base_path('vendor/laravel/ui/stubs/migrations')))
90 | ->each(function (SplFileInfo $file) use ($filesystem) {
91 | $filesystem->copy(
92 | $file->getPathname(),
93 | database_path('migrations/'.$file->getFilename())
94 | );
95 | });
96 | }
97 |
98 | protected static function scaffoldAuth()
99 | {
100 | file_put_contents(app_path('Http/Controllers/HomeController.php'), static::compileControllerStub());
101 |
102 | file_put_contents(
103 | base_path('routes/web.php'),
104 | "\n\nAuth::routes();\n\nRoute::get('/home', [\App\Http\Controllers\HomeController::class, 'index'])->name('home');\n\n",
105 | FILE_APPEND
106 | );
107 | }
108 |
109 | protected static function compileControllerStub()
110 | {
111 | return str_replace(
112 | '{{namespace}}',
113 | Container::getInstance()->getNamespace(),
114 | file_get_contents(__DIR__.'/../stubs/controllers/HomeController.stub')
115 | );
116 | }
117 |
118 | protected static function updatePagination()
119 | {
120 | (new Filesystem)->delete(resource_path('views/vendor/paginate'));
121 |
122 | (new Filesystem)->copyDirectory(__DIR__.'/../stubs/resources/views/vendor/pagination', resource_path('views/vendor/pagination'));
123 | }
124 |
125 | protected static function scaffoldAuthViews()
126 | {
127 | (new Filesystem)->copyDirectory(__DIR__.'/../stubs/resources/views', resource_path('views'));
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/stubs/controllers/HomeController.stub:
--------------------------------------------------------------------------------
1 | middleware('auth');
17 | }
18 |
19 | /**
20 | * Show the application dashboard.
21 | *
22 | * @return \Illuminate\Contracts\Support\Renderable
23 | */
24 | public function index()
25 | {
26 | return view('home');
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/stubs/resources/css/app.css:
--------------------------------------------------------------------------------
1 | @import "tailwindcss/base";
2 | /* @import "./custom-base-styles.css"; */
3 |
4 | @import "tailwindcss/components";
5 | /* @import "./custom-components.css"; */
6 |
7 | @import "tailwindcss/utilities";
8 | /* @import "./custom-utilities.css"; */
--------------------------------------------------------------------------------
/stubs/resources/views/auth/login.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
{{ __('Please confirm your password before continuing.') }}
9 | 10 | 30 |{{ session('status') }}
17 |{{ __('A fresh verification link has been sent to your email address.') }}
17 |{{ __('Before proceeding, please check your email for a verification link.') }} {{ __('If you did not receive the email') }},
23 | 24 | 28 |{{ session('status') }}
18 |{{ __('You are logged in!') }}
24 |