niccolox
Solid Filesystem basic syntax help
question about basic Filesystem usage for the Solid hex for Liquid templating. Cross-posting from Github basic Filesystem usage syntax · Issue #96 · edgurgel/solid · GitHub
what am I missing for filesystem usage in a simple Phoenix index action below?
def index(conn, _params) do
template_path = "/lib/app_web/templates/liquid/"
file_system = Solid.LocalFileSystem.new(template_path)
text = Solid.LocalFileSystem.full_path(file_system, "hello")
render(conn, text)
end
/lib/app_web/templates/liquid/_hello.liquid
hello
gives
** (FunctionClauseError) no function clause matching in String.match?/2
(elixir 1.12.2) lib/string.ex:2259: String.match?(%Solid.LocalFileSystem{pattern: "_%s.liquid", root: "/lib/app_web/templates/liquid/"}, ~r/^[^.\/][a-zA-Z0-9_\/]+$/)
(solid 0.10.0) lib/solid/file_system.ex:84: Solid.LocalFileSystem.full_path/2
no doubt missing some basic config or awareness around the correct syntax
First Post!
outlog
maybe you need a Path.absname("foo") eg
template_path = Path.absname("/lib/app_web/templates/liquid/")
also the docs for solid are not coherent on Solid.LocalFileSystem.full_path according to code the argument order is Solid.LocalFileSystem.full_path( "hello", file_system) (yours is opposite) - maybe PR a doc fix..
0
Popular in Questions
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I’m writing a test for one of the...
New
I have VueJS GUIs with the project generated using Webpack.
I have Elixir modules that will need to be used by the VueJS GUIs.
I forese...
New
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
Other popular topics
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I’m writing a test for one of the...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Phoenix 1.4.0 released
Phoenix 1.4 is out! This release ships with exciting new features, most notably
with HTTP2 support, improved deve...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









