Skip to content

Commit

Permalink
replace laravel mix with vite
Browse files Browse the repository at this point in the history
  • Loading branch information
liorocks2 committed May 20, 2024
1 parent 0a2ad9c commit 09d3369
Show file tree
Hide file tree
Showing 41 changed files with 3,667 additions and 9,791 deletions.
17 changes: 8 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
/bootstrap/ssr
/node_modules
/public/css
/public/hot
/public/js
/public/mix-manifest.json
/public/build
/public/storage
/storage/*.key
/database/*.sqlite
/vendor
.DS_Store
.env
.php_cs.dist
.env.backup
.phpunit.result.cache
.php-cs-fixer.php
.php-cs-fixer.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.idea/
.flex/
.vscode/
/.idea
/.vscode
13,165 changes: 3,600 additions & 9,565 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 7 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
{
"private": true,
"type": "module",
"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",
"prod": "vite build"
},
"dependencies": {
"@babel/preset-react": "^7.18.6",
"@inertiajs/react": "^1.0.0",
"@sentry/browser": "^7.32.1",
"autoprefixer": "^10.4.13",
"axios": "^1.2.3",
"classnames": "^2.3.2",
"cross-env": "^7.0.3",
"eslint": "^8.32.0",
"laravel-mix": "^6.0.49",
"lodash": "^4.17.21",
"postcss-import": "^15.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"react-use": "^17.4.0",
"resolve-url-loader": "^5.0.0",
"tailwindcss": "^3.2.4"
"tailwindcss": "^3.4.3"
},
"devDependencies": {
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"babel-eslint": "^10.1.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint-plugin-react": "^7.32.1",
"laravel-vite-plugin": "^1.0.4",
"postcss": "^8.4.21",
"react-refresh": "^0.14.0"
"vite": "^5.2.11"
}
}
8 changes: 8 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
plugins: {
'postcss-import': {},
'tailwindcss/nesting': {},
tailwindcss: {},
autoprefixer: {}
}
};
12 changes: 4 additions & 8 deletions resources/css/app.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/* Base */
@import 'tailwindcss/base';
@import 'tailwindcss/components';

/* Components */
@import 'components/button';
@import 'components/form';
@import 'components/button';

/* Utilities */
@import 'tailwindcss/utilities';
@tailwind base;
@tailwind components;
@tailwind utilities;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default () => {
as="button"
href={route('logout')}
className="block w-full px-6 py-2 text-left focus:outline-none hover:bg-indigo-600 hover:text-white"
method="post"
method="DELETE"
>
Logout
</Link>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 0 additions & 12 deletions resources/js/app.js

This file was deleted.

12 changes: 12 additions & 0 deletions resources/js/app.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createInertiaApp } from '@inertiajs/react';
import { createRoot } from 'react-dom/client';

createInertiaApp({
resolve: name => {
const pages = import.meta.glob('./Pages/**/*.jsx');
return pages[`./Pages/${name}.jsx`]();
},
setup({ el, App, props }) {
createRoot(el).render(<App {...props} />);
}
});
8 changes: 2 additions & 6 deletions resources/views/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link href="{{ mix('css/app.css') }}" rel="stylesheet">
<script src="{{ mix('js/manifest.js') }}" defer></script>
<script src="{{ mix('js/vendor.js') }}" defer></script>
<script src="{{ mix('js/app.js') }}" defer></script>
@routes
@inertiaHead
@viteReactRefresh
@vite(['resources/css/app.css', 'resources/js/app.jsx'])
</head>
<body class="font-sans antialiased leading-none text-gray-800">

@inertia

</body>
</html>
97 changes: 18 additions & 79 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,23 @@
module.exports = {
purge: ['./resources/views/**/*.blade.php', './resources/js/**/*.js'],
darkMode: false, // or 'media' or 'class'
theme: {
colors: {
transparent: 'transparent',
current: 'currentColor',

black: '#000',
white: '#fff',
import defaultTheme from 'tailwindcss/defaultTheme';

gray: {
100: '#f7fafc',
200: '#edf2f7',
300: '#e2e8f0',
400: '#cbd5e0',
500: '#a0aec0',
600: '#718096',
700: '#4a5568',
800: '#2d3748',
900: '#1a202c'
},
red: {
100: '#fff5f5',
200: '#fed7d7',
300: '#feb2b2',
400: '#fc8181',
500: '#f56565',
600: '#e53e3e',
700: '#c53030',
800: '#9b2c2c',
900: '#742a2a'
},
orange: {
100: '#fffaf0',
200: '#feebc8',
300: '#fbd38d',
400: '#f6ad55',
500: '#ed8936',
600: '#dd6b20',
700: '#c05621',
800: '#9c4221',
900: '#7b341e'
},
yellow: {
100: '#fffff0',
200: '#fefcbf',
300: '#faf089',
400: '#f6e05e',
500: '#ecc94b',
600: '#d69e2e',
700: '#b7791f',
800: '#975a16',
900: '#744210'
},
green: {
100: '#f0fff4',
200: '#c6f6d5',
300: '#9ae6b4',
400: '#68d391',
500: '#48bb78',
600: '#38a169',
700: '#2f855a',
800: '#276749',
900: '#22543d'
export default {
content: ['./resources/**/*.{js,jsx,blade.php}'],
theme: {
extend: {
colors: {
indigo: {
100: '#e6e8ff',
300: '#b2b7ff',
400: '#7886d7',
500: '#6574cd',
600: '#5661b3',
800: '#2f365f',
900: '#191e38'
}
},
indigo: {
100: '#ebf4ff',
200: '#c3dafe',
300: '#a3bffa',
400: '#7f9cf5',
500: '#667eea',
600: '#5a67d8',
700: '#4c51bf',
800: '#434190',
900: '#3c366b'
fontFamily: {
sans: ['"Cerebri Sans"', ...defaultTheme.fontFamily.sans]
}
}
},
variants: {
extend: {}
},
plugins: []
}
};
7 changes: 7 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import react from '@vitejs/plugin-react';

export default defineConfig({
plugins: [laravel(['resources/js/app.jsx', 'resources/css/app.css']), react()]
});
55 changes: 0 additions & 55 deletions webpack.fix.js

This file was deleted.

41 changes: 0 additions & 41 deletions webpack.mix.js

This file was deleted.

0 comments on commit 09d3369

Please sign in to comment.