Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetpack Components #5

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -62,39 +62,41 @@ config :logger, :console,
config :phoenix, :json_library, Jason

config :live_view_native, plugins: [
LiveViewNative.SwiftUI,
LiveViewNative.Jetpack,
LiveViewNative.SwiftUI
]

config :mime, :types, %{
"text/swiftui" => ["swiftui"],
"text/jetpack" => ["jetpack"],
"text/styles" => ["styles"]
"text/styles" => ["styles"],
"text/swiftui" => ["swiftui"]
}

# LVN - Required, you must configure LiveView Native Stylesheets
# on where class names shoudl be extracted from
config :live_view_native_stylesheet,
content: [
swiftui: [
"lib/**/*swiftui*"
],
jetpack: [
"lib/**/*jetpack*"
],
swiftui: [
"lib/**/*swiftui*"
]
],
output: "priv/static/assets"

# LVN - Required, you must configure Phoenix to know how
# to encode for the swiftui format
config :phoenix_template, :format_encoders, [
swiftui: Phoenix.HTML.Engine,
jetpack: Phoenix.HTML.Engine
jetpack: Phoenix.HTML.Engine,
swiftui: Phoenix.HTML.Engine
]

# LVN - Required, you must configure Phoenix so it knows
# how to compile LVN's neex templates
config :phoenix, :template_engines, neex: LiveViewNative.Engine
config :phoenix, :template_engines, [
neex: LiveViewNative.Engine
]

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
Expand Down
5 changes: 4 additions & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ config :form_demo, FormDemoWeb.Endpoint,
patterns: [
~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/form_demo_web/(controllers|live|components|styles)/.*(ex|heex|neex)$"
~r"lib/form_demo_web/(controllers|live|components|styles)/.*(ex|heex|neex)$",
~r"lib/form_demo_web/(live|components)/.*neex$",
~r"lib/form_demo_web/styles/*.ex$",
~r"priv/static/*.styles$"
]
]

Expand Down
23 changes: 13 additions & 10 deletions lib/form_demo_native.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ defmodule FormDemoNative do
quote do
use LiveViewNative.LiveView,
formats: [
:jetpack,
:swiftui
],
layouts: [
jetpack: {FormDemoWeb.Layouts.Jetpack, :app},
swiftui: {FormDemoWeb.Layouts.SwiftUI, :app}
]

Expand Down Expand Up @@ -104,7 +106,7 @@ defmodule FormDemoNative do
defmodule MyAppWeb.Layouts.SwiftUI do
use MyAppNative, [:layout, format: :swiftui]

embed_tempaltes "layouts_swiftui/*"
embed_templates "layouts_swiftui/*"
end
'''
def layout(opts) do
Expand All @@ -123,8 +125,9 @@ defmodule FormDemoNative do
gettext_quoted = quote do
import FormDemoWeb.Gettext
end

plugin = LiveViewNative.fetch_plugin!(format)

plugin_component_quoted = try do
Code.ensure_compiled!(plugin.component)

Expand All @@ -135,7 +138,7 @@ defmodule FormDemoNative do
_ -> nil
end

live_form_component_quoted = quote do
live_form_quoted = quote do
import LiveViewNative.LiveForm.Component
end

Expand All @@ -152,13 +155,13 @@ defmodule FormDemoNative do
end

[
gettext_quoted,
plugin_component_quoted,
live_form_component_quoted,
core_component_quoted,
verified_routes()
]

gettext_quoted,
plugin_component_quoted,
live_form_quoted,
core_component_quoted,
verified_routes()
]
end

@doc """
Expand Down
Loading