diff --git a/assets/build.mjs b/assets/build.mjs index 30c7c7f0..8dadd93a 100644 --- a/assets/build.mjs +++ b/assets/build.mjs @@ -1,13 +1,3 @@ -// 2023-04-07 -// -// This file does not work with esbuild > 0.16 as esbuild’s API has changed in -// 0.17. -// -// esbuild-sass-plugin is pinned to version < 2.6 because versions > 2.5 require -// esbuild 0.17. -// -// https://github.com/evanw/esbuild/blob/main/CHANGELOG.md#0170 - import esbuild from 'esbuild'; import ElmPlugin from 'esbuild-plugin-elm'; import { sassPlugin } from 'esbuild-sass-plugin'; @@ -35,14 +25,6 @@ let opts = { plugins, }; -if (watch) { - opts = { - ...opts, - watch, - sourcemap: 'inline', - }; -} - if (deploy) { opts = { ...opts, @@ -50,14 +32,19 @@ if (deploy) { }; } -const promise = esbuild.build(opts); - if (watch) { - promise.then((_result) => { - process.stdin.on('close', () => { - process.exit(0); + opts = { + ...opts, + sourcemap: 'inline', + }; + esbuild + .context(opts) + .then((ctx) => { + ctx.watch(); + }) + .catch((_error) => { + process.exit(1); }); - - process.stdin.resume(); - }); +} else { + esbuild.build(opts); } diff --git a/lib/ex_rss_web/endpoint.ex b/lib/ex_rss_web/endpoint.ex index 7e483043..97fdb5a2 100644 --- a/lib/ex_rss_web/endpoint.ex +++ b/lib/ex_rss_web/endpoint.ex @@ -11,7 +11,7 @@ defmodule ExRssWeb.Endpoint do at: "/", from: :ex_rss, gzip: false, - only: ~w(css fonts images js favicon.ico robots.txt) + only: ~w(assets fonts images favicon.ico robots.txt) # Code reloading can be explicitly enabled under the # :code_reloader configuration of your endpoint. diff --git a/lib/ex_rss_web/templates/layout/app.html.eex b/lib/ex_rss_web/templates/layout/app.html.eex index 59e8b8ae..c7755b99 100644 --- a/lib/ex_rss_web/templates/layout/app.html.eex +++ b/lib/ex_rss_web/templates/layout/app.html.eex @@ -8,7 +8,8 @@ Hello ExRss! - "> + "> + @@ -19,6 +20,5 @@ <%= @inner_content %> -