Skip to content

Commit

Permalink
feat: help users that visit the vite dev server directly (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElMassimo authored Mar 16, 2023
1 parent 3dd3093 commit 0f40a1d
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 1 deletion.
66 changes: 66 additions & 0 deletions vite-plugin-ruby/src/dev-server-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Vite Ruby</title>

<link rel="icon" href="data:image/svg+xml,%3Csvg viewBox='0 0 366 304' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M91.95 46.973a5.5 5.5 0 00-.401.722l-59.724 69.638a5.5 5.5 0 00.003 7.165l147 171.086a5.502 5.502 0 008.344 0l147-171.084a5.5 5.5 0 00.003-7.165l-59.723-69.637a5.5 5.5 0 00-4.996-3.198H96.543a5.5 5.5 0 00-4.592 2.473z' fill='url(%23paint0_linear)' stroke='url(%23paint1_linear)' stroke-width='11' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M265.857 19.004l-116.154 5.598a4.346 4.346 0 00-3.643 3.885v109.121c-.267 2.885 2.326 5.217 5.182 4.659l20.815-4.659c3.114-.608 5.819 2.194 5.082 5.268l-8.01 45.423c-.767 3.199 2.18 6.052 5.371 5.201l17.232-3.395c3.195-.852 6.144 2.01 5.369 5.211l-18.069 74.653c-1.13 4.67 5.068 7.44 7.82 3.495l1.838-2.635L291.703 81.887c1.725-3.163-.947-6.923-4.518-6.357l-34.224 5.417c-3.217.508-5.839-2.544-4.834-5.627l22.576-50.691c1.006-3.088-1.626-6.144-4.846-5.625z' fill='url(%23paint2_linear)'/%3E%3Cdefs%3E%3ClinearGradient id='paint0_linear' x1='28.5' y1='34' x2='246.355' y2='194.428' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23FF006B'/%3E%3Cstop offset='.364' stop-color='%23C00'/%3E%3Cstop offset='1' stop-color='%23980D03'/%3E%3C/linearGradient%3E%3ClinearGradient id='paint1_linear' x1='28.5' y1='34' x2='246.355' y2='194.428' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23FF006B'/%3E%3Cstop offset='.364' stop-color='%23C00'/%3E%3Cstop offset='1' stop-color='%23980D03'/%3E%3C/linearGradient%3E%3ClinearGradient id='paint2_linear' x1='183.666' y1='-5.499' x2='211.353' y2='242.278' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23FFDD35'/%3E%3Cstop offset='.083' stop-color='%23FFD233'/%3E%3Cstop offset='.594' stop-color='%23FFA800'/%3E%3Cstop offset='.839' stop-color='%23F90'/%3E%3C/linearGradient%3E%3C/defs%3E%3C/svg%3E" type="image/svg+xml" />

<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">

<!-- Styles -->
<style>
/* ! tailwindcss v3.1.4 | MIT License | https://tailwindcss.com */*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Nunito,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.fixed{position:fixed}.relative{position:relative}.top-0{top:0px}.right-0{right:0px}.z-0{z-index:0}.mx-auto{margin-left:auto;margin-right:auto}.ml-3{margin-left:.75rem}.-ml-px{margin-left:-1px}.ml-1{margin-left:.25rem}.mt-2{margin-top:.5rem}.mr-2{margin-right:.5rem}.ml-2{margin-left:.5rem}.mt-4{margin-top:1rem}.ml-4{margin-left:1rem}.mt-8{margin-top:2rem}.ml-12{margin-left:3rem}.-mt-px{margin-top:-1px}.mt-6{margin-top:1.5rem}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-5{height:1.25rem}.h-8{height:2rem}.h-16{height:4rem}.h-6{height:1.5rem}.min-h-screen{min-height:100vh}.w-5{width:1.25rem}.w-8{width:2rem}.w-auto{width:auto}.w-6{width:1.5rem}.max-w-xl{max-width:36rem}.max-w-6xl{max-width:72rem}.flex-1{flex:1 1 0%}.cursor-default{cursor:default}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-items-center{justify-items:center}.space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-300>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(209 213 219 / var(--tw-divide-opacity))}.overflow-hidden{overflow:hidden}.rounded-md{border-radius:.375rem}.rounded-lg{border-radius:.5rem}.rounded-l-md{border-top-left-radius:.375rem;border-bottom-left-radius:.375rem}.rounded-r-md{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}.border{border-width:1px}.border-t{border-top-width:1px}.border-r{border-right-width:1px}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-gray-400{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.p-6{padding:1.5rem}.px-4{padding-left:1rem;padding-right:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pt-8{padding-top:2rem}.pt-10{padding-top:2.5rem}.pb-8{padding-bottom:2rem}.text-center{text-align:center}.text-sm{font-size:.875rem;line-height:1.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-base{font-size:1rem;line-height:1.5rem}.font-medium{font-weight:500}.font-semibold{font-weight:600}.font-bold{font-weight:700}.uppercase{text-transform:uppercase}.leading-5{line-height:1.25rem}.leading-7{line-height:1.75rem}.tracking-wider{letter-spacing:.05em}.text-gray-500{color:rgb(107 114 128)}.text-gray-700{color:rgb(55 65 81)}.text-gray-200{color:rgb(229 231 235)}.text-gray-300{color:rgb(209 213 219)}.text-gray-400{color:rgb(156 163 175)}.text-gray-600{color:rgb(75 85 99)}.text-gray-900{color:rgb(17 24 39)}.text-red-500{color:#d53f3f}.text-red-600{color:#c00}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-gray-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity))}.ring-gray-900{--tw-ring-opacity: 1;--tw-ring-color: rgb(17 24 39 / var(--tw-ring-opacity))}.ring-gray-900\/5{--tw-ring-color: rgb(17 24 39 / .05)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\:text-gray-500:hover{color:rgb(107 114 128)}.hover\:text-gray-400:hover{color:rgb(156 163 175)}.hover\:text-red-600:hover{color:rgb(220 38 38)}.focus\:z-10:focus{z-index:10}.focus\:border-blue-300:focus{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.active\:bg-gray-100:active{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.active\:text-gray-700:active{color:rgb(55 65 81)}.active\:text-gray-500:active{color:rgb(107 114 128)}@media (prefers-color-scheme: dark){.dark\:divide-gray-700>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(55 65 81 / var(--tw-divide-opacity))}.dark\:bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.dark\:bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.dark\:text-gray-400{color:rgb(156 163 175)}.dark\:text-gray-100{color:rgb(243 244 246)}}@media (min-width: 640px){.sm\:mx-auto{margin-left:auto;margin-right:auto}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:max-w-xl{max-width:36rem}.sm\:flex-1{flex:1 1 0%}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-between{justify-content:space-between}.sm\:rounded-lg{border-radius:.5rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-12{padding-top:3rem;padding-bottom:3rem}.sm\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\:pt-0{padding-top:0}}@media (min-width: 1024px){.lg\:px-8{padding-left:2rem;padding-right:2rem}}
</style>
</head>
<body class="antialiased">
<div class="relative flex min-h-screen flex-col justify-center overflow-hidden bg-gray-100 text-gray-600 dark:text-gray-400 dark:bg-gray-900 py-6 sm:py-12">
<div class="relative bg-white dark:bg-gray-800 px-6 pt-10 pb-8 shadow-xl ring-1 ring-gray-900/5 sm:mx-auto sm:max-w-xl sm:rounded-lg sm:px-10">
<div class="mx-auto">
<div class="flex items-center justify-center space-x-6">
<a href="https://vite-ruby.netlify.app/">

<svg class="h-16 w-auto" viewBox="0 0 366 304" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M91.95 46.973a5.5 5.5 0 00-.401.722l-59.724 69.638a5.5 5.5 0 00.003 7.165l147 171.086a5.502 5.502 0 008.344 0l147-171.084a5.5 5.5 0 00.003-7.165l-59.723-69.637a5.5 5.5 0 00-4.996-3.198H96.543a5.5 5.5 0 00-4.592 2.473z" fill="url(#paint_ruby_0)" stroke="url(#paint_ruby_1)" stroke-width="11" stroke-linecap="round" stroke-linejoin="round"/><path d="M265.857 19.004l-116.154 5.598a4.346 4.346 0 00-3.643 3.885v109.121c-.267 2.885 2.326 5.217 5.182 4.659l20.815-4.659c3.114-.608 5.819 2.194 5.082 5.268l-8.01 45.423c-.767 3.199 2.18 6.052 5.371 5.201l17.232-3.395c3.195-.852 6.144 2.01 5.369 5.211l-18.069 74.653c-1.13 4.67 5.068 7.44 7.82 3.495l1.838-2.635L291.703 81.887c1.725-3.163-.947-6.923-4.518-6.357l-34.224 5.417c-3.217.508-5.839-2.544-4.834-5.627l22.576-50.691c1.006-3.088-1.626-6.144-4.846-5.625z" fill="url(#paint_ruby_2)"/><defs><linearGradient id="paint_ruby_0" x1="28.5" y1="34" x2="246.355" y2="194.428" gradientUnits="userSpaceOnUse"><stop stop-color="#FF006B"/><stop offset=".364" stop-color="#C00"/><stop offset="1" stop-color="#980D03"/></linearGradient><linearGradient id="paint_ruby_1" x1="28.5" y1="34" x2="246.355" y2="194.428" gradientUnits="userSpaceOnUse"><stop stop-color="#FF006B"/><stop offset=".364" stop-color="#C00"/><stop offset="1" stop-color="#980D03"/></linearGradient><linearGradient id="paint_ruby_2" x1="183.666" y1="-5.499" x2="211.353" y2="242.278" gradientUnits="userSpaceOnUse"><stop stop-color="#FFDD35"/><stop offset=".083" stop-color="#FFD233"/><stop offset=".594" stop-color="#FFA800"/><stop offset=".839" stop-color="#F90"/></linearGradient></defs></svg>
</a>
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" />
</svg>
<a href="https://vitejs.dev">
<svg viewBox="0 0 410 404" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-16 w-auto">
<path d="M399.641 59.5246L215.643 388.545C211.844 395.338 202.084 395.378 198.228 388.618L10.5817 59.5563C6.38087 52.1896 12.6802 43.2665 21.0281 44.7586L205.223 77.6824C206.398 77.8924 207.601 77.8904 208.776 77.6763L389.119 44.8058C397.439 43.2894 403.768 52.1434 399.641 59.5246Z" fill="url(#paint0_linear)" />
<path d="M292.965 1.5744L156.801 28.2552C154.563 28.6937 152.906 30.5903 152.771 32.8664L144.395 174.33C144.198 177.662 147.258 180.248 150.51 179.498L188.42 170.749C191.967 169.931 195.172 173.055 194.443 176.622L183.18 231.775C182.422 235.487 185.907 238.661 189.532 237.56L212.947 230.446C216.577 229.344 220.065 232.527 219.297 236.242L201.398 322.875C200.278 328.294 207.486 331.249 210.492 326.603L212.5 323.5L323.454 102.072C325.312 98.3645 322.108 94.137 318.036 94.9228L279.014 102.454C275.347 103.161 272.227 99.746 273.262 96.1583L298.731 7.86689C299.767 4.27314 296.636 0.855181 292.965 1.5744Z" fill="url(#paint1_linear)" />
<defs>
<linearGradient id="paint0_linear" x1="6.00017" y1="32.9999" x2="235" y2="344" gradientUnits="userSpaceOnUse">
<stop stop-color="#41D1FF" />
<stop offset="1" stop-color="#BD34FE" />
</linearGradient>
<linearGradient id="paint1_linear" x1="194.651" y1="8.81818" x2="236.076" y2="292.989" gradientUnits="userSpaceOnUse">
<stop stop-color="#FFEA83" />
<stop offset="0.0833333" stop-color="#FFDD35" />
<stop offset="1" stop-color="#FFA800" />
</linearGradient>
</defs>
</svg>
</a>
</div>
<div class="divide-y divide-gray-300 dark:divide-gray-700">
<div class="py-8 text-base leading-7">
<p>This is the Vite development server that provides Hot Module Replacement for your Ruby application.</p>
<p class="mt-6">To access your Ruby application, you will need to run a local development server.</p>
<h2 class="mt-6"><a href="https://guides.rubyonrails.org/command_line.html" class="font-semibold text-red-600 hover:text-red-500">The Rails Command Line</a></h2>
<p>Start the Rails server by running: <code>bin/rails s</code></p>
</div>
<div class="pt-8 text-base leading-7">
<p>Want more information on Vite Ruby's Rails integration?</p>
<p>
<a href="https://vite-ruby.netlify.app/guide/rails.html" class="font-semibold text-red-600 hover:text-red-500">Read the docs &rarr;</a>
</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
13 changes: 12 additions & 1 deletion vite-plugin-ruby/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { basename, posix } from 'path'
import { basename, posix, resolve } from 'path'
import { existsSync, readFileSync } from 'fs'
import type { ConfigEnv, PluginOption, UserConfig, ViteDevServer } from 'vite'
import createDebugger from 'debug'

Expand Down Expand Up @@ -74,6 +75,16 @@ function config (userConfig: UserConfig, env: ConfigEnv): UserConfig {
// Internal: Allows to watch additional paths outside the source code dir.
function configureServer (server: ViteDevServer) {
server.watcher.add(watchAdditionalPaths)

return () => server.middlewares.use((req, res, next) => {
if (req.url === '/index.html' && !existsSync(resolve(server.config.root, 'index.html'))) {
res.statusCode = 404
const file = readFileSync(resolve(__dirname, 'dev-server-index.html'), 'utf-8')
res.end(file)
}

next()
})
}

function outputOptions (assetsDir: string, ssrBuild: boolean) {
Expand Down
Loading

0 comments on commit 0f40a1d

Please sign in to comment.