This repository has been archived on 2023-08-07. You can view files and clone it, but cannot push or open issues or pull requests.
temple/mix.exs

81 lines
1.8 KiB
Elixir
Raw Normal View History

2019-07-02 02:48:51 +00:00
defmodule Temple.MixProject do
2019-04-15 01:44:39 +00:00
use Mix.Project
def project do
[
2019-07-02 02:48:51 +00:00
app: :temple,
name: "Temple",
2022-04-20 04:05:27 +00:00
description: "An HTML DSL for Elixir",
2022-09-20 00:37:10 +00:00
version: "0.10.0",
2019-07-04 00:36:04 +00:00
package: package(),
elixirc_paths: elixirc_paths(Mix.env()),
elixir: "~> 1.13",
2019-04-15 01:44:39 +00:00
start_permanent: Mix.env() == :prod,
2019-05-09 02:06:44 +00:00
deps: deps(),
2019-07-02 02:48:51 +00:00
source_url: "https://github.com/mhanberg/temple",
docs: docs()
2019-04-15 01:44:39 +00:00
]
end
# Specifies which paths to compile per environment.
Dynamic Attributes (#190) * Move directories for ast tests to match convention * feat!: Rename `:let` to `:let!` We use the "bang" style as the reserved keyword to differentiate it from other possible attributes. * feat: use Phoenix.HTML as the default engine I am choosing to leverage this library in order to quickly get dynamic attributes (see #183) up and running. This also ensures that folks who wish to use Temple outside of a Phoenix project with get some nice HTML functions as well as properly escaped HTML out of the box. This can be made optional if Temple becomes decoupled from the render and it including HTML specific packages becomes a strange. * feat: Allow user to make their own Component module The component module is essentially to defer compiling functions that the user might not need. The component, render_slot, and inner_block functions are only mean to be used when there isn't another implementation. In the case of a LiveView application, LiveView is providing the component runtime implementation. This was causing some compile time warnings for temple, because it was using the LiveView engine at compile time (for Temple, not the user's application) and LiveView hadn't been compiled or loaded. So, now we defer this to the user to make their own module and import it where necessary. * feat: Pass dynamic attributes with the :rest! attribute The :rest! attribute can be used to pass in a dynamic list of attributes to be mixed into the static ones at runtime. Since this cannot be properly escaped by any engine, we have to mark it as safe and then allow the function to escape it for us. I decided to leverage the `attributes_escape/1` function from `phoenix_html`. There isn't really any point in making my own version of this or vendoring it. Now you can also pass a variable as the attributes as well if you only want to pass through attributes from a calling component. The :rest! attribute also works with components, allowing you to pass a dynamic list of args into them. Fixes #183 * Move test components to their own file. * docs(components): Update documentation on Temple.Components * docs(guides): Mention attributes_escape/1 function in the guides * chore(test): Move helper to it's own module * feat: rest! support for slots * docs(guides): Dynamic attributes * ci: downgrade runs-on to support OTP 23
2023-01-21 11:44:29 +00:00
defp elixirc_paths(:test) do
# hack to get the right compiler options used on the non-script files in
# test/support
Code.put_compiler_option(
:parser_options,
Keyword.put(Code.get_compiler_option(:parser_options), :token_metadata, true)
)
["lib", "test/support"]
end
defp elixirc_paths(_), do: ["lib"]
2019-04-15 01:44:39 +00:00
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
2019-07-02 02:48:51 +00:00
defp docs() do
[
main: "Temple",
extras: [
"README.md",
"guides/getting-started.md",
"guides/your-first-template.md",
"guides/components.md",
"guides/converting-html.md",
"guides/migrating/0.8-to-0.9.md"
],
groups_for_extras: groups_for_extras()
]
end
defp groups_for_extras do
[
Guides: ~r/guides\/[^\/]+\.md/,
Migrating: ~r/guides\/migrating\/.?/
]
end
2019-07-04 00:36:04 +00:00
defp package do
[
maintainers: ["Mitchell Hanberg"],
licenses: ["MIT"],
links: %{github: "https://github.com/mhanberg/temple"},
files: ~w(lib priv CHANGELOG.md LICENSE mix.exs README.md .formatter.exs)
]
end
2019-04-15 01:44:39 +00:00
defp deps do
[
{:floki, ">= 0.0.0"},
Dynamic Attributes (#190) * Move directories for ast tests to match convention * feat!: Rename `:let` to `:let!` We use the "bang" style as the reserved keyword to differentiate it from other possible attributes. * feat: use Phoenix.HTML as the default engine I am choosing to leverage this library in order to quickly get dynamic attributes (see #183) up and running. This also ensures that folks who wish to use Temple outside of a Phoenix project with get some nice HTML functions as well as properly escaped HTML out of the box. This can be made optional if Temple becomes decoupled from the render and it including HTML specific packages becomes a strange. * feat: Allow user to make their own Component module The component module is essentially to defer compiling functions that the user might not need. The component, render_slot, and inner_block functions are only mean to be used when there isn't another implementation. In the case of a LiveView application, LiveView is providing the component runtime implementation. This was causing some compile time warnings for temple, because it was using the LiveView engine at compile time (for Temple, not the user's application) and LiveView hadn't been compiled or loaded. So, now we defer this to the user to make their own module and import it where necessary. * feat: Pass dynamic attributes with the :rest! attribute The :rest! attribute can be used to pass in a dynamic list of attributes to be mixed into the static ones at runtime. Since this cannot be properly escaped by any engine, we have to mark it as safe and then allow the function to escape it for us. I decided to leverage the `attributes_escape/1` function from `phoenix_html`. There isn't really any point in making my own version of this or vendoring it. Now you can also pass a variable as the attributes as well if you only want to pass through attributes from a calling component. The :rest! attribute also works with components, allowing you to pass a dynamic list of args into them. Fixes #183 * Move test components to their own file. * docs(components): Update documentation on Temple.Components * docs(guides): Mention attributes_escape/1 function in the guides * chore(test): Move helper to it's own module * feat: rest! support for slots * docs(guides): Dynamic attributes * ci: downgrade runs-on to support OTP 23
2023-01-21 11:44:29 +00:00
{:phoenix_html, "~> 3.2"},
{:typed_struct, "~> 0.3"},
{:ex_doc, "~> 0.29.0", only: :dev, runtime: false}
2019-04-15 01:44:39 +00:00
]
end
end