Skip to content

Commit e914b50

Browse files
Introduce esbuild plugin based
1 parent 697d938 commit e914b50

File tree

12 files changed

+1069
-58
lines changed

12 files changed

+1069
-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: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
includePaths: ["node_modules", "node_modules/bistyles_phoenix/scss"]
18+
})
19+
]
20+
21+
let opts = {
22+
entryPoints: ['js/app.js', 'bitstyles/assets/images/icons.svg'],
23+
bundle: true,
24+
target: 'es2016',
25+
outdir: '../priv/static/assets',
26+
logLevel: 'info',
27+
loader,
28+
assetNames: "assets/[name]",
29+
plugins
30+
}
31+
32+
if (watch) {
33+
opts = {
34+
...opts,
35+
watch,
36+
sourcemap: 'inline'
37+
}
38+
}
39+
40+
if (deploy) {
41+
opts = {
42+
...opts,
43+
minify: true
44+
}
45+
}
46+
47+
const promise = esbuild.build(opts)
48+
49+
if (watch) {
50+
promise.then(_result => {
51+
process.stdin.on('close', () => {
52+
process.exit(0)
53+
})
54+
55+
process.stdin.resume()
56+
})
57+
}

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)