<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ben Sharman</title>
    <description>The latest articles on Forem by Ben Sharman (@mutablestate).</description>
    <link>https://forem.com/mutablestate</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F174896%2Fe4809dbc-a678-4b4b-96e6-d6c9d69ea08a.jpg</url>
      <title>Forem: Ben Sharman</title>
      <link>https://forem.com/mutablestate</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mutablestate"/>
    <language>en</language>
    <item>
      <title>Customise a new Phoenix app (Part 2 - Style)</title>
      <dc:creator>Ben Sharman</dc:creator>
      <pubDate>Thu, 27 Jun 2019 00:42:15 +0000</pubDate>
      <link>https://forem.com/mutablestate/customise-a-new-phoenix-app-part-2-style-1dh4</link>
      <guid>https://forem.com/mutablestate/customise-a-new-phoenix-app-part-2-style-1dh4</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;TL;DR try &lt;a href="https://github.com/mutablestate/custom_phx" rel="noopener noreferrer"&gt;CustomPhx - GitHub&lt;/a&gt; in a new Phoenix project to automate Tailwindcss installation and HTML generation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In &lt;a href="https://dev.to/mutablestate/customise-a-new-phoenix-app-part-1-outdated-packages-a1o"&gt;Part 1&lt;/a&gt; of this series we updated both &lt;code&gt;mix&lt;/code&gt; and &lt;code&gt;NPM&lt;/code&gt; dependencies in a new Phoenix project. Let's continue our customisations with some style! &lt;/p&gt;

&lt;p&gt;You generate a new Phoenix project. Do you continue building on top of the default styles? or &lt;em&gt;choose your own adventure&lt;/em&gt;?&lt;/p&gt;

&lt;h3&gt;
  
  
  Phoenix Default
&lt;/h3&gt;

&lt;p&gt;Since Phoenix 1.4, all new projects include the minimal CSS framework &lt;a href="https://milligram.io/" rel="noopener noreferrer"&gt;Milligram&lt;/a&gt; in &lt;code&gt;assets/phoenix.css&lt;/code&gt;. This provides &lt;code&gt;classless&lt;/code&gt; markup for any HTML generated with &lt;a href="https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Gen.Html.html" rel="noopener noreferrer"&gt;mix phx.gen.html&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Style with Milligram
&lt;/h3&gt;

&lt;p&gt;You chose Milligram! &lt;/p&gt;

&lt;p&gt;You have sensible defaults and can use the generators to get up and running quickly.&lt;/p&gt;

&lt;p&gt;To theme your project write custom classes and add them to your markup. Check out &lt;a href="https://github.com/milligram/awesome-milligram" rel="noopener noreferrer"&gt;Awesome Milligram&lt;/a&gt; for additional resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  Style with something else
&lt;/h3&gt;

&lt;p&gt;You chose to replace Milligram! &lt;/p&gt;

&lt;p&gt;You have options. Lots of options. Start with this categorised list &lt;a href="https://github.com/troxler/awesome-css-frameworks" rel="noopener noreferrer"&gt;Awesome CSS Frameworks&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Installation instructions are specific to each framework but if it comes with a pre-processor (LESS, SCSS, SASS, PostCSS) you'll need to install a &lt;code&gt;loader&lt;/code&gt; to &lt;code&gt;package.json&lt;/code&gt; and configure it in &lt;code&gt;webpack.config.js&lt;/code&gt;. See  &lt;a href="https://webpack.js.org/loaders/#styling" rel="noopener noreferrer"&gt;Webpack Loaders - Styling&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Unfortunately, the Phoenix HTML generated files will look unstyled and may require significant markup changes and additional classes to look good in a new framework. Alternatively you can &lt;a href="https://dev.to/mutablestate/customise-your-phoenix-html-generator-2l85"&gt;Customise your Phoenix HTML Generator&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Style with Tailwindcss
&lt;/h3&gt;

&lt;p&gt;I chose &lt;a href="https://tailwindcss.com/#what-is-tailwind" rel="noopener noreferrer"&gt;Tailwindcss&lt;/a&gt;! &lt;/p&gt;

&lt;p&gt;This utility-first framework recently matured into a &lt;code&gt;1.0&lt;/code&gt; release and has quite a buzz around it (fully justified IMO).&lt;/p&gt;

&lt;p&gt;For a basic install see the excellent &lt;a href="https://www.derrickreimer.com/tech/2019/06/12/tailwind-phoenix.html" rel="noopener noreferrer"&gt;Using Tailwind with Phoenix&lt;/a&gt; guide.&lt;/p&gt;

&lt;p&gt;For a more comprehensive approach i've created a mix archive to automate installation with a custom HTML generator &lt;a href="https://github.com/mutablestate/custom_phx" rel="noopener noreferrer"&gt;CustomPhx - GitHub&lt;/a&gt;. Give it a try!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Generated form field markup&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt; &lt;span class="ss"&gt;class:&lt;/span&gt; &lt;span class="s2"&gt;"block mb-6"&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="p"&gt;%&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"form-label block"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;text_input&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;class:&lt;/span&gt; &lt;span class="s2"&gt;"form-input w-full mt-1"&lt;/span&gt; &lt;span class="p"&gt;%&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;%&lt;/span&gt; &lt;span class="k"&gt;end&lt;/span&gt; &lt;span class="p"&gt;%&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;error_tag&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt; &lt;span class="p"&gt;%&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Generated form&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhtmghusaih16gww7rcd4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhtmghusaih16gww7rcd4.png"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>elixir</category>
      <category>phoenix</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>Customise a new Phoenix app (Part 1 - Outdated Packages)</title>
      <dc:creator>Ben Sharman</dc:creator>
      <pubDate>Sat, 15 Jun 2019 08:37:29 +0000</pubDate>
      <link>https://forem.com/mutablestate/customise-a-new-phoenix-app-part-1-outdated-packages-a1o</link>
      <guid>https://forem.com/mutablestate/customise-a-new-phoenix-app-part-1-outdated-packages-a1o</guid>
      <description>&lt;p&gt;At the end of the &lt;a href="https://hexdocs.pm/phoenix/up_and_running.html"&gt;Phoenix Up and Running Guide&lt;/a&gt; it logically suggests &lt;br&gt;
&lt;code&gt;The next step is customising our application just a bit…&lt;/code&gt; and whisks you away to learn about &lt;a href="https://hexdocs.pm/phoenix/adding_pages.html"&gt;Adding Pages&lt;/a&gt;. I'd like to recommend a few extra steps of customisation to get familiar with before building out a new application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Outdated packages
&lt;/h3&gt;

&lt;p&gt;Even with a shiny new Phoenix project generated from the latest archive your &lt;code&gt;hex&lt;/code&gt; and &lt;code&gt;npm&lt;/code&gt; dependencies are likely to contain old or insecure versions. Perform these checks immediately after install and make them part of your maintenance routine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Find and update outdated Hex dependencies&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run &lt;a href="https://hexdocs.pm/hex/Mix.Tasks.Hex.Outdated.html"&gt;mix hex.outdated&lt;/a&gt; to output a table.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dependency&lt;/th&gt;
&lt;th&gt;Current&lt;/th&gt;
&lt;th&gt;Latest&lt;/th&gt;
&lt;th&gt;Update possible&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ecto_sql&lt;/td&gt;
&lt;td&gt;3.1.5&lt;/td&gt;
&lt;td&gt;3.1.5&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If your &lt;code&gt;Update possible&lt;/code&gt; column is clear or contains only &lt;code&gt;Yes&lt;/code&gt; then run &lt;a href="https://hexdocs.pm/mix/master/Mix.Tasks.Deps.Update.html"&gt;mix deps.update --all&lt;/a&gt; to update all dependencies and compile them. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If any dependencies have a &lt;code&gt;No&lt;/code&gt; in the &lt;code&gt;Update possible&lt;/code&gt; column then an automated update is not possible. This package has likely broken its API contract with a &lt;code&gt;major&lt;/code&gt; version bump. You'll need to check package release notes for the upgrade process. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NOTES: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;From the docs: &lt;code&gt;Upgrading a dependency often requires the projects it depends on to upgrade too.&lt;/code&gt; In this situation you can &lt;a href="https://hexdocs.pm/mix/master/Mix.Tasks.Deps.Update.html#module-mix-deps-unlock-mix-deps-get"&gt;update a single dependency and not touch its children&lt;/a&gt;.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As an extra precaution run &lt;a href="https://hexdocs.pm/hex/Mix.Tasks.Hex.Audit.html"&gt;mix hex.audit&lt;/a&gt; to show all Hex dependencies that have been marked as retired.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Find and update outdated NPM packages&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run &lt;a href="https://docs.npmjs.com/cli/outdated.html"&gt;npm outdated&lt;/a&gt; from your &lt;code&gt;assets&lt;/code&gt; directory to output a table.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Package&lt;/th&gt;
&lt;th&gt;Current&lt;/th&gt;
&lt;th&gt;Wanted&lt;/th&gt;
&lt;th&gt;Latest&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;css-loader&lt;/td&gt;
&lt;td&gt;2.1.1&lt;/td&gt;
&lt;td&gt;2.1.1&lt;/td&gt;
&lt;td&gt;3.0.0&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For consistency, and after being bitten a few times over the years, I recommend directly editing the version numbers in your &lt;code&gt;package.json&lt;/code&gt; file to the &lt;code&gt;Latest&lt;/code&gt;. For major version bumps check the release notes before upgrading.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;npm install&lt;/code&gt; to add the new packages in &lt;code&gt;/node_modules&lt;/code&gt;, generate an updated &lt;code&gt;package.lock.json&lt;/code&gt; and output a security report summary from &lt;a href="https://docs.npmjs.com/cli/audit.html"&gt;npm audit&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;audited 14403 packages in 6.166s
found 4 vulnerabilities (2 low, 1 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If you have any vulnerabilities then run &lt;code&gt;npm audit&lt;/code&gt; to get more details on each one. I'm cautious to automate this process and prefer to upgrade the packages manually in &lt;code&gt;package.json&lt;/code&gt;. In your case and especially if this is a new project try &lt;code&gt;npm audit fix&lt;/code&gt; to update packages without breaking changes or &lt;code&gt;npm audit fix --force&lt;/code&gt; to install breaking changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NOTES: The output from &lt;code&gt;npm outdated&lt;/code&gt; may not list all potential updates. A workaround for VSCode users is to hover over each package in &lt;code&gt;package.json&lt;/code&gt; to get a tooltip about that package with the latest version (other editors may require extensions).&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iG7zKoaW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/1zmowv3t4c2g6rgrghy8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iG7zKoaW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/1zmowv3t4c2g6rgrghy8.png" alt="" width="774" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Look out for &lt;strong&gt;Customise a new Phoenix app (Part 2 - Style)&lt;/strong&gt; coming soon. I'm bringing some style to your new app by replacing the default CSS framework &lt;a href="https://milligram.io/"&gt;Milligram&lt;/a&gt; with &lt;a href="https://tailwindcss.com/"&gt;Tailwindcss&lt;/a&gt; and sharing some tips on avoiding spaghetti CSS.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do you have any customisations you like to perform after a new Phoenix install?&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>elixir</category>
      <category>phoenix</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>Customise your Phoenix HTML Generator</title>
      <dc:creator>Ben Sharman</dc:creator>
      <pubDate>Fri, 10 Mar 2017 19:26:20 +0000</pubDate>
      <link>https://forem.com/mutablestate/customise-your-phoenix-html-generator-2l85</link>
      <guid>https://forem.com/mutablestate/customise-your-phoenix-html-generator-2l85</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AFBJdKJt9CTNCpV4dMzPJaw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AFBJdKJt9CTNCpV4dMzPJaw.jpeg"&gt;&lt;/a&gt;Generator Hostel Dublin by &lt;a href="https://www.flickr.com/photos/yukino/" rel="noopener noreferrer"&gt;Rosa G&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE: 2019 update in progress... Phoenix 1.4 and Tailwindcss ftw&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What’s it all about?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Scaffolding with Phoenix generators, especially with &lt;code&gt;mix phx.gen.html&lt;/code&gt;, is a great way start out a project. Not only do you get a resource all wired up for CRUD it also provides unit tests and demonstrates best practices.&lt;/p&gt;

&lt;p&gt;All this sounds great so why did I stop using such a powerful ally after that initial burst of enthusiasm? I think the main reason was the desire to take off the proverbial training wheels provided by the generator and get writing some sweet Elixir code. My confidence was up and going it alone was aided by a helpful feedback loop of error messages and stack traces.&lt;/p&gt;

&lt;p&gt;The fundamental point i’d completely missed of using a generator with templates is achieving consistency through automation. Consistency is one of the keys to a maintainable codebase and also happens to be the basis of a great UX. By customising the Phoenix HTML generator maybe I can achieve both of these goals.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The scenario&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Being an opinionated software engineer I’ve decided my new CRUD project will use &lt;a href="https://milligram.github.io/" rel="noopener noreferrer"&gt;Milligram&lt;/a&gt;, a minimalist css framework, instead of the standard bootstrap css used by Phoenix and most of the web. Making that one simple decision renders the standard Phoenix HTML generator pretty useless.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One of many solutions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Replace the standard &lt;code&gt;mix phx.gen.html&lt;/code&gt; with a project specific generator and templates. The templates can then be updated and re-used to generate each new resource I add with the latest styles and layout.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let’s do it!&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new Phoenix 1.3 project
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mix phx.new boiler &amp;amp;&amp;amp; cd boiler
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Replace assets/css/phoenix.css with milligram.css&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make the templates and mix task project directories&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir -p priv/templates/boiler.gen.html &amp;amp;&amp;amp; mkdir -p lib/boiler/mix/tasks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Copy all current HTML generator templates to the new project templates directory
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp -a deps/phoenix/priv/templates/phx.gen.html/. priv/templates/boiler.gen.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Copy the current generator task to the new project tasks directory
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp deps/phoenix/lib/mix/tasks/phx.gen.html.ex lib/boiler/mix/tasks/boiler.gen.html.ex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open &lt;code&gt;lib/boiler/mix/tasks/boiler.gen.html.ex&lt;/code&gt; in your favourite editor and update the module name to &lt;code&gt;Mix.Tasks.Boiler.Gen.Html&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the same file search / replace all instances of lowercase &lt;code&gt;phx&lt;/code&gt; with &lt;code&gt;boiler&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check that your code compiles and you have a boiler project mix task&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mix compile &amp;amp;&amp;amp; mix help | grep boiler
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If all went well you should see our new mix task listed as &lt;code&gt;mix boiler.gen.html&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Its time to edit the &lt;code&gt;eex&lt;/code&gt; templates in &lt;code&gt;priv/templates/boiler.gen.html&lt;/code&gt; using Milligram classes and any markup changes before using our new generator command.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Milligram uses a different grid system to bootstrap so we also need to update &lt;code&gt;lib/boiler/web/templates/layout/app.html.eex&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Its generate time!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use our new mix task as you would with the Phoenix generator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mix boiler.gen.html Accounts User users name:string email:string phone:string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the instructions to add the resource to the router and run the migrations.&lt;/p&gt;

&lt;p&gt;Start the server with &lt;code&gt;mix phx.server&lt;/code&gt; and visit &lt;a href="http://localhost:4000/users" rel="noopener noreferrer"&gt;http://localhost:4000/users&lt;/a&gt; to see your custom generated HTML templates in action.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don’t stop now&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is a small example of generating custom markup for a CRUD app but its only a taster of what’s possible.&lt;/p&gt;

&lt;p&gt;Are you using Phoenix custom generators in creative ways?&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

&lt;p&gt;The repo can be found at &lt;a href="https://github.com/mutablestate/boiler" rel="noopener noreferrer"&gt;https://github.com/mutablestate/boiler&lt;/a&gt;&lt;/p&gt;

</description>
      <category>elixir</category>
      <category>phoenix</category>
    </item>
  </channel>
</rss>
