From b2248d8c83ce7ad342132d86922e5a7ea55befb0 Mon Sep 17 00:00:00 2001 From: Sophie Alpert Date: Fri, 6 Jul 2018 21:15:51 -0700 Subject: [PATCH] Fix flash of unstyled content in dev mode In dev mode, we were pulling in styles as part of app.js which comes after all the content. If we move these to a separate bundle that's loaded in it's more representative of how CSS is loaded in prod, and we don't get a flash of unstyled content in dev. --- assets/webpack.config.js | 6 ++---- lib/candidate_website/views/layout_view.ex | 6 +++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/assets/webpack.config.js b/assets/webpack.config.js index 3fa09988..84deaff0 100755 --- a/assets/webpack.config.js +++ b/assets/webpack.config.js @@ -23,10 +23,8 @@ module.exports = (env) => { context: __dirname, entry: { - app: [ - "js/app.js", - "stylus/app.styl" - ] + styles: ["stylus/app.styl"], + app: ["js/app.js"], }, output: { diff --git a/lib/candidate_website/views/layout_view.ex b/lib/candidate_website/views/layout_view.ex index dbc3644d..69e238b2 100644 --- a/lib/candidate_website/views/layout_view.ex +++ b/lib/candidate_website/views/layout_view.ex @@ -9,7 +9,11 @@ defmodule CandidateWebsite.LayoutView do ~s() ) - @css_src Application.get_env(:candidate_website, :css_src, "") + @css_src Application.get_env( + :candidate_website, + :css_src, + ~s() + ) def js_script_tag, do: @script_src