Skip to content

Commit

Permalink
chore: fix protocol slash on tailwind viewer logger (#765)
Browse files Browse the repository at this point in the history
* chore: fix typo

* chore: fix typo use ufo
  • Loading branch information
Gehbt authored Nov 21, 2023
1 parent 2632195 commit ff7a7c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/viewer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { underline, yellow } from 'colorette'
import { eventHandler, sendRedirect } from 'h3'
import { addDevServerHandler, isNuxt2, isNuxt3, useLogger, useNuxt } from '@nuxt/kit'
import { withTrailingSlash, withoutTrailingSlash, joinURL } from 'ufo'
import { withTrailingSlash, withoutTrailingSlash, joinURL,cleanDoubleSlashes } from 'ufo'
import { relative } from 'pathe'
import type { TWConfig, ViewerConfig } from './types'

@@ -24,7 +24,7 @@ export const setupViewer = async (twConfig: Partial<TWConfig>, config: ViewerCon
// @ts-ignore
if (isNuxt2()) { nuxt.options.serverMiddleware.push({ route, handler: (req, res) => viewerDevMiddleware(new H3Event(req, res)) }) }
nuxt.hook('listen', (_, listener) => {
const viewerUrl = `${withoutTrailingSlash(listener.url)}${route}`.replace(/\/+/g, '/')
const viewerUrl = `${cleanDoubleSlashes(joinURL(withoutTrailingSlash(listener.url), route))}`
logger.info(`Tailwind Viewer: ${underline(yellow(withTrailingSlash(viewerUrl)))}`)
})
}

0 comments on commit ff7a7c4

Please sign in to comment.