123movies-seo/vite.config.mjs

75 lines
2.2 KiB
JavaScript
Raw Normal View History

2024-08-24 23:08:42 +03:00
import fs from 'fs';
import {homedir} from 'os'
import {resolve} from 'path'
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import purge from '@erbelion/vite-plugin-laravel-purgecss'
import inject from '@rollup/plugin-inject';
let host = 'playlab.test'
export default defineConfig({
css: {
devSourcemap: true
},
resolve: {
alias: {
'~bootstrap': resolve(__dirname, 'node_modules/bootstrap'),
}
},
plugins: [
// inject({
// $: 'jquery',
// jQuery: 'jquery',
// include:'**.js'
// }),
laravel({
input: [
'resources/scss/app.scss',
'resources/scss/player.scss',
'resources/vendor/css/fontawesome-all.min.css',
'resources/vendor/css/line-awesome.min.css',
'resources/js/app.js',
'resources/js/img.js',
'resources/js/load-more.js',
'resources/js/jqfix.js',
// 'resources/js/components/Player.js',
],
refresh: {paths:['./resources/*','./resources/views/*','./resources/views/*/*', './resources/scss/*', './resources/js/*'], config:true},
}),
purge({
templates: ['blade'],
safelist: {
deep: [/dropdown-menu$/, /navbar$/],
greedy: [/la-(long|facebook|linkedin|twitter|pinterest)/,/show$/, /collapsing$/, /aos/, /data/, /reveal/, /show-filters/, /modal/, /collapsed/, /expand/, /slideout/, /^navbar/, /collapse/, /slick/, /prev/, /next/]
},
})
],
server: detectServerConfig(host),
});
function detectServerConfig(host) {
let keyPath = resolve(homedir(), `.valet/Certificates/${host}.key`)
let certificatePath = resolve(homedir(), `.valet/Certificates/${host}.crt`)
if (!fs.existsSync(keyPath)) {
return {}
}
if (!fs.existsSync(certificatePath)) {
return {}
}
return {
hmr: {host},
host,
https: {
key: fs.readFileSync(keyPath),
cert: fs.readFileSync(certificatePath),
},
}
}