Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/slime-lang/phoenix_slime
Phoenix Template Engine for Slime
https://github.com/slime-lang/phoenix_slime
elixir elixir-phoenix phoenix phoenix-slime phoenix-template-engine slime
Last synced: about 1 month ago
JSON representation
Phoenix Template Engine for Slime
- Host: GitHub
- URL: https://github.com/slime-lang/phoenix_slime
- Owner: slime-lang
- License: mit
- Created: 2015-08-04T21:14:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-11-29T20:21:31.000Z (about 1 year ago)
- Last Synced: 2024-10-17T21:50:44.190Z (about 2 months ago)
- Topics: elixir, elixir-phoenix, phoenix, phoenix-slime, phoenix-template-engine, slime
- Language: Elixir
- Homepage:
- Size: 94.7 KB
- Stars: 310
- Watchers: 11
- Forks: 66
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Slim template support for Phoenix. (Framework Components)
- fucking-awesome-elixir - phoenix_slime - Slim template support for Phoenix. (Framework Components)
- awesome-elixir - phoenix_slime - Slim template support for Phoenix. (Framework Components)
README
# Phoenix Template Engine for Slim
[![Build Status][github-img]][github] [![Hex Version][hex-img]][hex] [![License][license-img]][license]
> Powered by [Slime](https://github.com/slime-lang/slime)
[github-img]: https://github.com/slime-lang/slime/actions/workflows/ci.yml/badge.svg
[github]: https://github.com/slime-lang/slime/actions/workflows/ci.yml
[hex-img]: https://img.shields.io/hexpm/v/phoenix_slime.svg
[hex]: https://hex.pm/packages/phoenix_slime
[license-img]: http://img.shields.io/badge/license-MIT-brightgreen.svg
[license]: http://opensource.org/licenses/MIT## Usage
1. Add `{:phoenix_slime, "~> 0.13.1"}` to your deps in `mix.exs`.
2. Add the following to your Phoenix `config/config.exs`:```elixir
config :phoenix, :template_engines,
slim: PhoenixSlime.Engine,
slime: PhoenixSlime.Engine,
slimleex: PhoenixSlime.LiveViewEngine # If you want to use LiveView
```An example project can be found at [slime-lang/phoenix_slime_example][phoenix_slime_example].
[phoenix_slime_example]: https://github.com/slime-lang/phoenix_slime_example
## Live Reloader
In `my_app/config/dev.exs`, include the `slim` and `slime` extensions in the list of watched files. (Replace `APP` with your app name.)```elixir
# Watch static and templates for browser reloading.
config :my_app, MyApp.Endpoint,
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif)$},
~r{web/views/.*(ex)$},
~r{lib/APP_web/templates/.*(eex|slim|slime)$}
]
]
```## Generators
This library also includes two `mix` tasks:
`mix phx.gen.html.slime`
`mix phx.gen.layout.slime`The first task creates a html resource in the same way `phx.gen.html` does
with the exception that all files are `.slime` files instead of `.eex` files.The second task creates a new `lib/APP_web/templates/layout/app.html.slime` with the
exact same content as the `app.html.eex` file. Do not forget to remove the old
`app.html.eex` file.Generated files have `.slime` extension by default. If you prefer `.slim`, you could add the following line to your config:
```elixir
config :phoenix_slime, :use_slim_extension, true
```## License
MIT license. Please see [LICENSE][license] for details.
[LICENSE]: https://github.com/slime-lang/slime/blob/master/LICENSE