Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to esbuild SASS #66

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Changelog

## Unreleased
## v1.1.0

## Added

- Support for 3.1.0 of bitstyles

## Changed

- Switched to esbuild plugin sass setup

## v1.0.0

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.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The package can be installed by adding `bitstyles_phoenix` to your list of depen
```elixir
def deps do
[
{:bitstyles_phoenix, "~> 1.0.0"}
{:bitstyles_phoenix, "~> 1.1.0"}
]
end
```
Expand Down
55 changes: 55 additions & 0 deletions demo/assets/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const esbuild = require('esbuild')

const { sassPlugin } = require("esbuild-sass-plugin");

const args = process.argv.slice(2)
const watch = args.includes('--watch')
const deploy = args.includes('--deploy')

const loader = {
'.woff': 'file',
'.woff2': 'file',
'.svg': 'file'
}

const plugins = [
sassPlugin({})
]

let opts = {
entryPoints: ['js/app.js', 'bitstyles/assets/images/icons.svg'],
bundle: true,
target: 'es2016',
outdir: '../priv/static/assets',
logLevel: 'info',
loader,
assetNames: "assets/[name]",
plugins
}

if (watch) {
opts = {
...opts,
watch,
sourcemap: 'inline'
}
}

if (deploy) {
opts = {
...opts,
minify: true
}
}

const promise = esbuild.build(opts)

if (watch) {
promise.then(_result => {
process.stdin.on('close', () => {
process.exit(0)
})

process.stdin.resume()
})
}
6 changes: 5 additions & 1 deletion demo/assets/css/app.scss
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
@import "../node_modules/bitstyles/scss/bitstyles.scss";
@use "~bitstyles/scss/bitstyles/settings/_typography" with (
$webfont-base-url: '../node_modules/bitstyles/assets/fonts/'
);

@use "~bitstyles/scss/bitstyles";
2 changes: 2 additions & 0 deletions demo/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Alpine from 'alpinejs'
import {Socket} from "phoenix"
import {LiveSocket} from "phoenix_live_view"

import "../css/app.scss"

let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}})

Expand Down
Loading