Skip to content

Commit

Permalink
Added assetPath and pageTitle to default Layout.hs
Browse files Browse the repository at this point in the history
Also fixed that the live reload script is included in the production app by default
  • Loading branch information
mpscholten committed Aug 3, 2021
1 parent 607cc37 commit ac21497
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions IHP/IDE/CodeGen/ApplicationGenerator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ generateGenericApplication applicationName =
<> " {stylesheets}\n"
<> " {scripts}\n"
<> "\n"
<> " <title>App</title>\n"
<> " <title>{pageTitleOrDefault \"App\"}</title>\n"
<> "</head>\n"
<> "<body>\n"
<> " <div class=\"container mt-4\">\n"
Expand All @@ -101,27 +101,36 @@ generateGenericApplication applicationName =
<> "</body>\n"
<> "|]\n"
<> "\n"
<> "-- The 'assetPath' function used below appends a `?v=SOME_VERSION` to the static assets in production\n"
<> "-- This is useful to avoid users having old CSS and JS files in their browser cache once a new version is deployed\n"
<> "-- See https://ihp.digitallyinduced.com/Guide/assets.html for more details\n"
<> "\n"
<> "stylesheets :: Html\n"
<> "stylesheets = [hsx|\n"
<> " <link rel=\"stylesheet\" href=\"/vendor/bootstrap.min.css\"/>\n"
<> " <link rel=\"stylesheet\" href=\"/vendor/flatpickr.min.css\"/>\n"
<> " <link rel=\"stylesheet\" href=\"/app.css\"/>\n"
<> " <link rel=\"stylesheet\" href={assetPath \"/vendor/bootstrap.min.css\"}/>\n"
<> " <link rel=\"stylesheet\" href={assetPath \"/vendor/flatpickr.min.css\"}/>\n"
<> " <link rel=\"stylesheet\" href={assetPath \"/app.css\"}/>\n"
<> " |]\n"
<> "\n"
<> "scripts :: Html\n"
<> "scripts = [hsx|\n"
<> " <script id=\"livereload-script\" src=\"/livereload.js\"></script>\n"
<> " <script src=\"/vendor/jquery-3.6.0.slim.min.js\"></script>\n"
<> " <script src=\"/vendor/timeago.js\"></script>\n"
<> " <script src=\"/vendor/popper.min.js\"></script>\n"
<> " <script src=\"/vendor/bootstrap.min.js\"></script>\n"
<> " <script src=\"/vendor/flatpickr.js\"></script>\n"
<> " <script src=\"/vendor/morphdom-umd.min.js\"></script>\n"
<> " <script src=\"/vendor/turbolinks.js\"></script>\n"
<> " <script src=\"/vendor/turbolinksInstantClick.js\"></script>\n"
<> " <script src=\"/vendor/turbolinksMorphdom.js\"></script>\n"
<> " <script src=\"/helpers.js\"></script>\n"
<> " <script src=\"/ihp-auto-refresh.js\"></script>\n"
<> " {when isDevelopment devScripts}\n"
<> " <script src={assetPath \"/vendor/jquery-3.6.0.slim.min.js\"}></script>\n"
<> " <script src={assetPath \"/vendor/timeago.js\"}></script>\n"
<> " <script src={assetPath \"/vendor/popper.min.js\"}></script>\n"
<> " <script src={assetPath \"/vendor/bootstrap.min.js\"}></script>\n"
<> " <script src={assetPath \"/vendor/flatpickr.js\"}></script>\n"
<> " <script src={assetPath \"/vendor/morphdom-umd.min.js\"}></script>\n"
<> " <script src={assetPath \"/vendor/turbolinks.js\"}></script>\n"
<> " <script src={assetPath \"/vendor/turbolinksInstantClick.js\"}></script>\n"
<> " <script src={assetPath \"/vendor/turbolinksMorphdom.js\"}></script>\n"
<> " <script src={assetPath \"/helpers.js\"}></script>\n"
<> " <script src={assetPath \"/ihp-auto-refresh.js\"}></script>\n"
<> " |]\n"
<> "\n"
<> "devScripts :: Html\n"
<> "devScripts = [hsx|\n"
<> " <script id=\"livereload-script\" src={assetPath \"/livereload.js\"}></script>\n"
<> " |]\n"
<> "\n"
<> "metaTags :: Html\n"
Expand Down

0 comments on commit ac21497

Please sign in to comment.