diff --git a/.gitignore b/.gitignore index 7cc8a8b6a..31946d3fc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /public/assets/* /public/img/* /public/hot +/public/build /public/storage /public/mix-manifest.json /storage/*.key diff --git a/.travis.yml b/.travis.yml index 10e618166..f0898722f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/docker/build.sh b/docker/build.sh index f8fcfa92d..30734d589 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -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 \ diff --git a/package.json b/package.json index cd602c133..4dd48be1c 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/resources/views/docs/index.blade.php b/resources/views/docs/index.blade.php index 7aee0a79c..4c9b05630 100644 --- a/resources/views/docs/index.blade.php +++ b/resources/views/docs/index.blade.php @@ -1,7 +1,7 @@ @extends('layout') @section('css') - + @vite('resources/css/docs.css') @endsection @section('content') @@ -9,5 +9,5 @@ @endsection @section('js') - + @vite('resources/js/docs.js') @endsection diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 000000000..4789b017f --- /dev/null +++ b/vite.config.js @@ -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, + }), + ], +}); diff --git a/webpack.mix.js b/webpack.mix.js deleted file mode 100644 index 138f9ec82..000000000 --- a/webpack.mix.js +++ /dev/null @@ -1,23 +0,0 @@ -let mix = require('laravel-mix'); - -/* - |-------------------------------------------------------------------------- - | Mix Asset Management - |-------------------------------------------------------------------------- - | - | Mix provides a clean, fluent API for defining some Webpack build steps - | for your Laravel application. By default, we are compiling the Sass - | file for the application as well as bundling up all the JS files. - | - */ - -mix - .js('resources/assets/js/docs.js', 'public/js') - .sass('resources/assets/sass/docs.scss', 'public/css') - .version(); - -mix - .sass('resources/assets/sass/app.scss', 'public/css') - .copy('resources/assets/img', 'public/img') - .copy('node_modules/govuk-frontend/assets/fonts', 'public/assets/fonts') - .version();