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

Migrate from Laravel Mix to Vite #69

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/public/assets/*
/public/img/*
/public/hot
/public/build
/public/storage
/public/mix-manifest.json
/storage/*.key
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ before_deploy: |
export HAS_RAN_BEFORE_DEPLOY="TRUE"

echo "Compiling assets for production..."
./develop npm run prod
./develop npm run build

echo "Installing AWS CLI..."
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
Expand Down
2 changes: 1 addition & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ echo "Installing NPM dependencies..."
./develop npm ci

echo "Compiling assets..."
./develop npm run prod
./develop npm run build
docker run --rm \
-w /opt \
-v ${TRAVIS_BUILD_DIR}/docker/app/packaged:/opt \
Expand Down
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
{
"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": {
"axios": "^0.25",
"govuk-frontend": "^2.3.0",
"laravel-mix": "^6.0.12",
"lodash": "^4.17.21",
"postcss": "^8.4.25",
"resolve-url-loader": "^5.0.0",
"sass": "^1.63.6",
"sass-loader": "^12.1.0",
"swagger-ui": "^4.19.1",
"vue": "^2.7.14"
"vue": "^2.7.14",
"vite": "^3.0.2",
"laravel-vite-plugin": "^0.6.0",
"@vitejs/plugin-vue2": "^1.1.2"
}
}
4 changes: 2 additions & 2 deletions resources/views/docs/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@extends('layout')

@section('css')
<link rel="stylesheet" href="{{ mix('/css/docs.css') }}">
@vite('resources/css/docs.css')
@endsection

@section('content')
<div id="docs"></div>
@endsection

@section('js')
<script src="{{ mix('/js/docs.js') }}"></script>
@vite('resources/js/docs.js')
@endsection
15 changes: 15 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

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

This file was deleted.