Skip to content

Commit

Permalink
Refine css generation and font reference (#188)
Browse files Browse the repository at this point in the history
* refactor: Ensure app.scss is converted and copied to priv/static in one command

* refactor: Add bootstrap-icon font

* refactor: Remove unnecessary slash

* style: Increase readability

* refactor: Relative path not necessary as node_modules is loaded by dart-sass

* chore: upgrade esbuild and dart_sass

---------

Co-authored-by: nwittstruck <[email protected]>
  • Loading branch information
gerardo-navarro and nwittstruck authored Mar 28, 2024
1 parent a661b3f commit ab82757
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
4 changes: 0 additions & 4 deletions assets/js/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// This file will be generated by dart_sass - this is the compiled css file:
// We include this here, so esbuild can handle e.g. copying fonts to the /priv/static/assets directory
import "../scss/app.css";

import { Modal, Tooltip } from "bootstrap"

// activate all tooltips:
Expand Down
2 changes: 1 addition & 1 deletion assets/scss/_bootstrap_custom.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Required
@import "../node_modules/bootstrap/scss/bootstrap";
@import "bootstrap/scss/bootstrap";

.card-body-mindwendel-idea {
@extend .card-body;
Expand Down
6 changes: 3 additions & 3 deletions assets/scss/app.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* This file is for your main application css. It will be compiled to app.css, which is then loaded by esbuild. */
@import "../node_modules/nprogress/nprogress";
@import "nprogress/nprogress";
@import "_bootstrap_custom.scss";

$bootstrap-icons-font-dir: "../node_modules/bootstrap-icons/font/fonts/";
$bootstrap-icons-font-dir: "/fonts/bootstrap-icons";

@import "../node_modules/bootstrap-icons/font/bootstrap-icons";
@import "bootstrap-icons/font/bootstrap-icons";
@import "live/idea_live/_index_component.scss";

@import "live/brainstorming_live/_show.scss";
Expand Down
20 changes: 15 additions & 5 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,28 @@ config :logger, :console,
config :phoenix, :json_library, Jason

config :esbuild,
version: "0.19.11",
version: "0.20.2",
default: [
args:
~w(js/app.js --bundle --target=es2016 --outdir=../priv/static/assets --external:/images/* --loader:.woff=file --loader:.woff2=file),
args: ~w(
js/app.js
--bundle
--target=es2016
--outdir=../priv/static/assets
--external:/images/*
--loader:.woff=file
--loader:.woff2=file
),
cd: Path.expand("../assets", __DIR__),
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
]

config :dart_sass,
version: "1.69.7",
version: "1.72.0",
default: [
args: ~w(scss/app.scss scss/app.css),
args: ~w(
scss/app.scss:../priv/static/assets/app.css
--load-path=node_modules
),
cd: Path.expand("../assets", __DIR__)
]

Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit ab82757

Please sign in to comment.