Skip to content

Commit 5356a2b

Browse files
Update to 0.5.1 (#21)
* update Tailwind to 0.5.1 * minor refactoring of preset code * improve responsiveness of login, register forms, and app nav * consolidate directory structure
1 parent 57beaa7 commit 5356a2b

File tree

12 files changed

+53
-66
lines changed

12 files changed

+53
-66
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "laravel-frontend-presets/tailwindcss",
3-
"description": "Laravel 5.5 frontend preset for Tailwind CSS",
3+
"description": "Laravel frontend preset for Tailwind CSS",
44
"keywords": ["laravel", "preset", "tailwindcss"],
55
"license": "MIT",
66
"require": {
7-
"laravel/framework": "5.5.*|5.6.*"
7+
"laravel/framework": "^5.5"
88
},
99
"autoload": {
1010
"psr-4": {

src/TailwindCssPreset.php

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,28 @@ public static function installAuth()
2626

2727
protected static function updatePackageArray(array $packages)
2828
{
29-
return [
30-
'tailwindcss' => '^0.4.0',
31-
'glob-all' => '*',
32-
'purgecss-webpack-plugin' => '*'
33-
] + Arr::except($packages, ['bootstrap', 'bootstrap-sass', 'jquery']);
29+
return array_merge([
30+
'laravel-mix-purgecss' => '^1.0',
31+
'tailwindcss' => '>=0.5.1',
32+
], Arr::except($packages, [
33+
'bootstrap',
34+
'bootstrap-sass',
35+
'jquery',
36+
'popper.js',
37+
]));
3438
}
3539

3640
protected static function updateStyles()
3741
{
38-
(new Filesystem)->deleteDirectory(resource_path('assets/sass'));
39-
(new Filesystem)->delete(public_path('js/app.js'));
40-
(new Filesystem)->delete(public_path('css/app.css'));
42+
tap(new Filesystem, function ($filesystem) {
43+
$filesystem->deleteDirectory(resource_path('assets/sass'));
44+
$filesystem->delete(public_path('js/app.js'));
45+
$filesystem->delete(public_path('css/app.css'));
4146

42-
if (! file_exists(resource_path('assets/css'))) {
43-
mkdir(resource_path('assets/css'));
44-
}
47+
if (! $filesystem->isDirectory($directory = resource_path('assets/css'))) {
48+
$filesystem->makeDirectory($directory, 0755, true);
49+
}
50+
});
4551

4652
copy(__DIR__.'/tailwindcss-stubs/resources/assets/css/main.css', resource_path('assets/css/main.css'));
4753
}
@@ -50,14 +56,14 @@ protected static function updateBootstrapping()
5056
{
5157
copy(__DIR__.'/tailwindcss-stubs/tailwind.js', base_path('tailwind.js'));
5258
copy(__DIR__.'/tailwindcss-stubs/webpack.mix.js', base_path('webpack.mix.js'));
53-
copy(__DIR__.'/tailwindcss-stubs/bootstrap.js', resource_path('assets/js/bootstrap.js'));
59+
copy(__DIR__.'/tailwindcss-stubs/resources/assets/js/bootstrap.js', resource_path('assets/js/bootstrap.js'));
5460
}
5561

5662
protected static function updateWelcomePage()
5763
{
5864
(new Filesystem)->delete(resource_path('views/welcome.blade.php'));
5965

60-
copy(__DIR__.'/tailwindcss-stubs/views/welcome.blade.php', resource_path('views/welcome.blade.php'));
66+
copy(__DIR__.'/tailwindcss-stubs/resources/views/welcome.blade.php', resource_path('views/welcome.blade.php'));
6167
}
6268

6369
protected static function scaffoldAuth()
@@ -70,7 +76,7 @@ protected static function scaffoldAuth()
7076
FILE_APPEND
7177
);
7278

73-
(new Filesystem)->copyDirectory(__DIR__.'/tailwindcss-stubs/views', resource_path('views'));
79+
(new Filesystem)->copyDirectory(__DIR__.'/tailwindcss-stubs/resources/views', resource_path('views'));
7480
}
7581

7682
protected static function compileControllerStub()

src/tailwindcss-stubs/resources/assets/css/main.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
*/
88
@tailwind preflight;
99

10+
/**
11+
* This injects any component classes registered by plugins.
12+
*
13+
* If using `postcss-import`, use this import instead:
14+
*
15+
* @import "tailwindcss/components";
16+
*/
17+
@tailwind components;
18+
1019
/**
1120
* Here you would add any of your custom component classes; stuff that you'd
1221
* want loaded *before* the utilities so that the utilities could still
@@ -26,6 +35,10 @@
2635
/**
2736
* This injects all of Tailwind's utility classes, generated based on your
2837
* config file.
38+
*
39+
* If using `postcss-import`, use this import instead:
40+
*
41+
* @import "tailwindcss/utilities";
2942
*/
3043
@tailwind utilities;
3144

@@ -38,7 +51,7 @@
3851
* .bg-pattern-graph-paper { ... }
3952
* .skew-45 { ... }
4053
*
41-
* Or if using a preprocessor..
54+
* Or if using a preprocessor or `postcss-import`:
4255
*
4356
* @import "utilities/background-patterns";
4457
* @import "utilities/skew-transforms";

src/tailwindcss-stubs/views/auth/login.blade.php renamed to src/tailwindcss-stubs/resources/views/auth/login.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
@extends('layouts.app')
22

33
@section('content')
4-
<div class="flex items-center">
5-
<div class="md:w-1/2 md:mx-auto">
4+
<div class="flex items-center px-6 md:px-0">
5+
<div class="w-full max-w-md md:mx-auto">
66
<div class="rounded shadow">
77
<div class="font-medium text-lg text-brand-darker bg-brand-lighter p-3 rounded-t">
88
Login

src/tailwindcss-stubs/views/auth/register.blade.php renamed to src/tailwindcss-stubs/resources/views/auth/register.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
@extends('layouts.app')
22

33
@section('content')
4-
<div class="flex items-center">
5-
<div class="md:w-1/2 md:mx-auto">
4+
<div class="flex items-center px-6 md:px-0">
5+
<div class="w-full max-w-md md:mx-auto">
66
<div class="rounded shadow">
77
<div class="font-medium text-lg text-brand-darker bg-brand-lighter p-3 rounded-t">
88
Register

src/tailwindcss-stubs/views/layouts/app.blade.php renamed to src/tailwindcss-stubs/resources/views/layouts/app.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</head>
1616
<body class="bg-brand-lightest h-screen">
1717
<div id="app">
18-
<nav class="bg-white h-12 shadow mb-8">
18+
<nav class="bg-white h-12 shadow mb-8 px-6 md:px-0">
1919
<div class="container mx-auto h-full">
2020
<div class="flex items-center justify-center h-12">
2121
<div class="mr-6">

0 commit comments

Comments
 (0)