In this short post I’ll walk you through getting a new Phoenix 1.4 app up and running with Bulma, a responsive, modular, and modern css framework. It feels light and it is really easy to use.


I prefer Yarn so let’s make sure it’s installed.

brew install yarn

Generate a new Phoenix 1.4 app

This assumes you have both Elixir and Phoenix installed already. If not checkout their guides which do a great job walking through the process.

mix bulma

Be sure NOT to install any dependencies when prompted.

Manually install all dependencies and create the database:

cd bulma && mix deps.get && mix ecto.create && cd assets && yarn add node-sass sass-loader bulma --dev && yarn && node node_modules/webpack/bin/webpack.js --mode development && cd ..

Switching to sass

Change our file extensions to sass and remove default styles:

mv assets/css/app.css assets/css/app.scss && sed -i '' 's/app.css/app.scss/g' assets/js/app.js && rm assets/css/phoenix.css

Open /assets/webpack.config.js and find the place that tests for css files, it should look like this:

  test: /\.css$/,
  use: [MiniCssExtractPlugin.loader, 'css-loader']

Now replace it with this:

  test: /\.s?css$/,
  use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']

Open /assets/css/app.scss and replace it with the following (mostly copied from the Bulma docs):

@charset "utf-8";

// Import a Google Font
@import url(',700');

// Set your brand colors
$purple: #8A4D76;
$pink: #FA7C91;
$brown: #757763;
$beige-light: #D0D1CD;
$beige-lighter: #EFF0EB;

// Update Bulma's global variables
$family-sans-serif: "Nunito", sans-serif;
$grey-dark: $brown;
$grey-light: $beige-light;
$primary: $purple;
$link: $pink;
$widescreen-enabled: false;
$fullhd-enabled: false;

// Update some of Bulma's component variables
$body-background-color: $beige-lighter;
$control-border-width: 2px;
$input-border-color: transparent;
$input-shadow: none;

//Import Bulma
@import 'bulma';

Open /lib/bulma_web/templates/page/index.html.eex and replace it with the following (again mostly copied from Bulma docs):

<section class="section">
  <h1 class="title">

  <p class="subtitle">
    Modern CSS framework based on <a href="">Flexbox</a>

  <div class="field">
    <div class="control">
      <input class="input" type="text" placeholder="Input">

  <div class="field">
    <p class="control">
      <span class="select">
          <option>Select dropdown</option>

  <div class="buttons">
    <a class="button is-primary">Primary</a>
    <a class="button is-link">Link</a>

Test it out

mix phx.server

package contents