Skip to content

Commit

Permalink
Fix liquid build
Browse files Browse the repository at this point in the history
  • Loading branch information
rokbar-nosto committed Dec 5, 2023
1 parent fe28d1f commit 62f9ec3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/liquid.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { DefaultState } from "./utils/state"
import { AnyPromise } from "./utils/promise"
import { Liquid } from "liquidjs"

declare global {
interface Window {
liquidjs?: {
Liquid: {
new (): Liquid
new(): {
parseAndRenderSync(template: string, state: object): string
}
}
}
}
Expand All @@ -23,7 +24,7 @@ declare global {
export function fromLiquidTemplate<State extends object = DefaultState>(
template: string
): (container: HTMLElement, state: State) => PromiseLike<void> {
const LiquidFactory = window.liquidjs?.Liquid
const LiquidFactory = window?.liquidjs?.Liquid
const instance = LiquidFactory ? new LiquidFactory() : undefined

if (instance === undefined) {
Expand Down

0 comments on commit 62f9ec3

Please sign in to comment.