Skip to content

Commit 520f810

Browse files
Introduce esbuild plugin based
1 parent 697d938 commit 520f810

File tree

12 files changed

+1067
-58
lines changed

12 files changed

+1067
-58
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# Changelog
22

3-
## Unreleased
3+
## v1.1.0
4+
5+
## Added
6+
7+
- Support for 3.1.0 of bitstyles
8+
9+
## Changed
10+
11+
- Switched to esbuild plugin sass setup
12+
13+
## v1.0.0
414

515
This version breaks with the existing API quite a lot 🔥, since we changed the library to take advantage of the recent develpments in Phoenix and LiveView.
616

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The package can be installed by adding `bitstyles_phoenix` to your list of depen
1818
```elixir
1919
def deps do
2020
[
21-
{:bitstyles_phoenix, "~> 1.0.0"}
21+
{:bitstyles_phoenix, "~> 1.1.0"}
2222
]
2323
end
2424
```

demo/assets/build.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
const esbuild = require('esbuild')
2+
3+
const { sassPlugin } = require("esbuild-sass-plugin");
4+
5+
const args = process.argv.slice(2)
6+
const watch = args.includes('--watch')
7+
const deploy = args.includes('--deploy')
8+
9+
const loader = {
10+
'.woff': 'file',
11+
'.woff2': 'file',
12+
'.svg': 'file'
13+
}
14+
15+
const plugins = [
16+
sassPlugin({})
17+
]
18+
19+
let opts = {
20+
entryPoints: ['js/app.js', 'bitstyles/assets/images/icons.svg'],
21+
bundle: true,
22+
target: 'es2016',
23+
outdir: '../priv/static/assets',
24+
logLevel: 'info',
25+
loader,
26+
assetNames: "assets/[name]",
27+
plugins
28+
}
29+
30+
if (watch) {
31+
opts = {
32+
...opts,
33+
watch,
34+
sourcemap: 'inline'
35+
}
36+
}
37+
38+
if (deploy) {
39+
opts = {
40+
...opts,
41+
minify: true
42+
}
43+
}
44+
45+
const promise = esbuild.build(opts)
46+
47+
if (watch) {
48+
promise.then(_result => {
49+
process.stdin.on('close', () => {
50+
process.exit(0)
51+
})
52+
53+
process.stdin.resume()
54+
})
55+
}

demo/assets/css/app.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
@import "../node_modules/bitstyles/scss/bitstyles.scss";
1+
@use "~bitstyles/scss/bitstyles/settings/_typography" with (
2+
$webfont-base-url: '../node_modules/bitstyles/assets/fonts/'
3+
);
4+
5+
@use "~bitstyles/scss/bitstyles";

demo/assets/js/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import Alpine from 'alpinejs'
33
import {Socket} from "phoenix"
44
import {LiveSocket} from "phoenix_live_view"
55

6+
import "../css/app.scss"
7+
68
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
79
let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}})
810

0 commit comments

Comments
 (0)