This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Resets a input to a value when a form is updated by LiveView. | |
* Add phx-hook="FormReset" to the form and phx-reset="" to the input you want to reset. | |
* The attribute phx-reset must contain the value that the input value will be reseted to. | |
*/ | |
Hooks.FormReset = { | |
updated() { | |
let input = this.el.querySelector('[phx-reset]:not(.invalid-feedback)') | |
let value = input.getAttribute('phx-reset') | |
input.value = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (!) This is a first-effort/ naive script to find unused CSS in HTML files. | |
# This should (hopefully) work as the opposite of what you get from PURGE CSS. | |
# Configure the variables bellow and execute the file with `elixir purge_html_css.exs`. | |
# Configures the default location to look for the outputed CSS. | |
# Ideally this file should not be transformed to preserve new lines. | |
outputed_css = "priv/static/css/app.css" | |
# Configures the default pattern to look for files that may contain CSS to purge. | |
# Currently inculdes .eex and .heex files. Change this if necessary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Constant do | |
@moduledoc """ | |
Allows generating dynamic functions for the given list of values. | |
Accepts an enumerable with the of keys and values to be generated as functions. | |
""" | |
defmacro __using__(constants) do | |
[define_constants(constants), define_helpers()] | |
end | |
defp define_constants(constants) when is_list(constants) do |
OlderNewer