liveview-native / live_view_native_stylesheet

MIT License
10 stars 4 forks source link

`~SHEET` doesn't compile when empty #38

Closed AZholtkevych closed 8 months ago

AZholtkevych commented 8 months ago

defmodule ExampleSheet do use LiveViewNative.Stylesheet, :swiftui ~SHEET""" """ end From @BrooklinJazz : I'd like to support that if possible for examples and exercises (Also, I think it's a better dev experience)

bcardarella commented 8 months ago

We'll leave open for now, but I just tried to reproduce and got this:

error: undefined function class/2 (expected ExampleSheet to define such a function or for it to be imported, but none are available)
  test/mocks/example_sheet.ex:2: ExampleSheet.compile_ast/2

This is happening not because of the ~SHEET sigil but because the compile_ast function expects at least one class/2 function to be defined. After v0.2.0 I have a fix already in that will inject the default def class(_, _), do: {:unmatched, ""} fallback via a @before_compile callback.

I'll close this out when that is pushed up