dcy
How to do "html minify" in Phoenix?
Hi! I want to do “html minify” with html-pages-brunch.
But it did not work, How to write the config?
Is there other better methods?
Most Liked
tolyo
On second thought, html-pages-brunch serves no real purpose in the context of Phoenix unless building a SPA with html templates of AngularJS variety. The plugin reloads your views on html save, which does not come out of the box with Brunch, so its a great convenience for dev env, but Phoenix already does that for your views anyway. The only time your actually want to do html minification is for prod releases, which can be handled by html-minifier from the command line during your build/deploy cycle. So it can look like this:
npm install html-minifier -g- define a make task
minify-templates: html-minifier --input-dir ./lib --output-dir ./lib --file-ext eex --collapse-whitespace --remove-comments --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true --minify-js true - run this task before build/deploy
- at the end of your run, undo changes made to your templates
git checkout .
Server side minification complete.
outlog
maybe this one: Packages | Hex
OvermindDL1
Or at least the ones that you put the plug on. ![]()
Hmm, interesting, old but updateable…
Popular in Questions
Other popular topics
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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









