Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Vite #9

Open
Driton007 opened this issue Oct 12, 2022 · 0 comments
Open

Upgrade to Vite #9

Driton007 opened this issue Oct 12, 2022 · 0 comments
Assignees

Comments

@Driton007
Copy link
Contributor

Driton007 commented Oct 12, 2022

Requirement:
Statamic ≥ v3.3.18
Laravel ≥ v9.19.0

  1. Run composer update to update your laravel and Statamic to the latest version.
  2. Run npm install --save-dev vite laravel-vite-plugin
  3. Create vite.config.js on root directory file and paste this code
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";

export default defineConfig({
    plugins: [
        laravel({
            input: ["resources/js/site.js", "resources/css/tailwind.css"],
            refresh: ["resources/views/**"],
        }),
    ],
    envPrefix: "MIX_",
});
  1. On package,json inside script tags paste this
"scripts": {
    "dev": "vite",
    "build": "vite build"
},

should look like this ^

  1. Create this file on the root directory postcss.config.js
    and paste this code
    plugins: {
        tailwindcss: {},
        autoprefixer: {},
    },
};
  1. On resources/views/layout.antlers.html
    Replace this tag
<link rel="stylesheet" href="{{ mix src='css/tailwind.css' }}">
<script src="{{ mix src='/js/site.js' }}" defer></script>

with

{{ vite src="resources/js/site.js|resources/css/tailwind.css" }} 
  1. Execute these command
    rm webpack.mix.js
    npm remove laravel-mix

  2. And finally run npm run dev for development site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant