diff --git a/bun.lockb b/bun.lockb index ea54506..dec149c 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/packages/core/src/_utils.scss b/packages/core/src/_utils.scss index d7032e7..4e42303 100644 --- a/packages/core/src/_utils.scss +++ b/packages/core/src/_utils.scss @@ -313,6 +313,12 @@ border-radius: var(--prj-border-radius); } +@each $index, $variable, $value in $spacings { + .msp-border-#{$index} { + border: #{$index}px var(--msp-border-style) var(--msp-border-color); + } +} + .msp-text-none { text-transform: none; } diff --git a/packages/website/.gitignore b/packages/website/.gitignore index f13c5cc..9ac1368 100644 --- a/packages/website/.gitignore +++ b/packages/website/.gitignore @@ -1,7 +1,7 @@ -# Manually linked deps managed by bun -sass/@** - +# Compiled assets managed by bun +static/css/**/* +static/js/**/* # Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore diff --git a/packages/website/_scripts/build.ts b/packages/website/_scripts/build.ts new file mode 100644 index 0000000..a4ecb9c --- /dev/null +++ b/packages/website/_scripts/build.ts @@ -0,0 +1,66 @@ +import type { BuildConfig, BunPlugin, PluginBuilder } from "bun"; +import type { FileImporter } from "sass"; + +const outdir = "./static"; + +const nodeModuleImporter: FileImporter<"async"> = { + findFileUrl(url) { + if (url.startsWith("@")) { + return new URL(import.meta.resolve(url)); + } + + return null; + }, +}; + +const sassPlugin: BunPlugin = { + name: "Sass Loader", + async setup(build: PluginBuilder) { + const sass = await import("sass"); + build.onLoad({ filter: /\.scss$/ }, async ({ path }) => { + // read and compile it with the sass compiler + const result = await sass.compileAsync(path, { + importers: [nodeModuleImporter], + }); + + return { + loader: "css", + contents: result.css, + }; + }); + }, +}; + +const assets: BuildConfig[] = [ + { + entrypoints: ["./sass/style.scss"], + outdir: `${outdir}/css`, + naming: "[name].css", + plugins: [sassPlugin], + minify: true, + + // On by default in Bun v1.2+ + html: true, + experimentalCss: true, + }, + + { + entrypoints: ["./js/index.ts"], + outdir: `${outdir}/js`, + target: "browser", + splitting: true, + minify: true, + }, +]; + +await Promise.all( + assets.map(async (item) => { + const result = await Bun.build(item); + + if (!result.success) { + throw new AggregateError(result.logs, "Build failed"); + } + }), +); + +console.log(`${Bun.color("#a6da95", "ansi")}Assets succesfully build!\x1b[0m`); diff --git a/packages/website/config.toml b/packages/website/config.toml index be866ed..aa8c799 100644 --- a/packages/website/config.toml +++ b/packages/website/config.toml @@ -3,8 +3,8 @@ base_url = "https://mini-strap.alecodes.page" output_dir = "dist" -# Whether to automatically compile all Sass files in the sass directory -compile_sass = true +# Managed by bun +compile_sass = false # Whether to build a search index to be used later on by a JavaScript library build_search_index = true diff --git a/packages/website/js/index.ts b/packages/website/js/index.ts new file mode 100644 index 0000000..a50e789 --- /dev/null +++ b/packages/website/js/index.ts @@ -0,0 +1 @@ +console.log("hello world!"); diff --git a/packages/website/package.json b/packages/website/package.json index 58a3ead..8e34106 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -6,13 +6,14 @@ "dev": "zola serve --port 3000 --fast" }, "dependencies": { - "@mini-strap/core": "workspace:*" + "@mini-strap/core": "workspace:*", + "@mini-strap/components": "workspace:*" }, "devDependencies": { - "@types/bun": "latest" + "@types/bun": "latest", + "sass": "^1.83.0" }, "peerDependencies": { "typescript": "^5.0.0" } } - diff --git a/packages/website/sass/style.scss b/packages/website/sass/style.scss index e903ac2..4643c8a 100644 --- a/packages/website/sass/style.scss +++ b/packages/website/sass/style.scss @@ -1,4 +1,4 @@ -@import "@mini-strap/core/style.scss"; +@use "@mini-strap/core"; html { // background-color: red; diff --git a/packages/website/templates/base.html b/packages/website/templates/base.html index 4a921e4..782fc79 100644 --- a/packages/website/templates/base.html +++ b/packages/website/templates/base.html @@ -1,22 +1,20 @@ - +
- - -