Skip to content

Commit

Permalink
feat: Make BrowserSync work with Valet and https
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCordes committed Apr 6, 2022
1 parent 27a94c8 commit 01e3ea0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
5 changes: 3 additions & 2 deletions configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ function determineSeparator(string $path): string {
}

function replaceForWindows(): array {
return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i vendor | findstr /v /i '.basename(__FILE__).' | findstr /r /i /M /F:/ ":author :vendor :package Anotherkit anotherkit vendor_name vendor_slug [email protected]"'));
return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i vendor | findstr /v /i '.basename(__FILE__).' | findstr /r /i /M /F:/ ":author :vendor :package local-url Anotherkit anotherkit vendor_name vendor_slug [email protected]"'));
}

function replaceForAllOtherOSes(): array {
return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|Anotherkit|anotherkit|vendor_name|vendor_slug|[email protected]" --exclude-dir=vendor ./* ./.github/* | grep -v ' . basename(__FILE__)));
return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|local-url|Anotherkit|anotherkit|vendor_name|vendor_slug|[email protected]" --exclude-dir=vendor ./* ./.github/* | grep -v ' . basename(__FILE__)));
}

$gitName = run('git config user.name');
Expand Down Expand Up @@ -121,6 +121,7 @@ function replaceForAllOtherOSes(): array {
':vendor_slug' => $vendorSlug,
':package_name' => $packageName,
':package_slug' => $packageSlug,
'local-url' => $folderName,
'Anotherkit' => $packageName,
'anotherkit' => $packageSlug,
':package_description' => $description,
Expand Down
7 changes: 3 additions & 4 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
module.exports = {
content: [
"./src/js/**/*.js",
"./site/**/*.php",
"./content/**/*.txt",
'./src/js/**/*.js',
'./site/**/*.php',
'./content/**/*.txt',
],
darkMode: 'media',
theme: {
extend: {},
},
Expand Down
29 changes: 24 additions & 5 deletions webpack.mix.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
const mix = require("laravel-mix")
// this is only needed to make BrowserSync work with Laravel Valet and https
const homedir = require('os').homedir()
const domain = 'local-url.test'

mix.setPublicPath("public")
mix.disableSuccessNotifications()
mix
.disableSuccessNotifications()
.setPublicPath("public")
.options({
processCssUrls: false,
})
.browserSync({
proxy: 'https://' + domain,
host: domain,
open: 'external',
https: {
key: homedir + '/.config/valet/Certificates/' + domain + '.key',
cert: homedir + '/.config/valet/Certificates/' + domain + '.crt'
},
files: [
'assets/css/**/*.css',
'assets/js/**/*.js',
'site/templates/**/*.php',
'site/snippets/**/*.php',
],
})

mix
.js("src/js/main.js", "public/js")
.postCss("src/css/main.css", "public/css", [
require("tailwindcss"),
])
.options({
processCssUrls: false,
})
.version()

0 comments on commit 01e3ea0

Please sign in to comment.