-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
# QGDS - Queensland Online MVP | ||
MVP development space for Queensland Online Design System | ||
# qgds-bootstrap-poc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/// DEV NOTE | ||
/// This build file is used for the demo/POC template rendering only | ||
/// Full templating system to be planned and implemented in the future | ||
|
||
import fs from "fs"; | ||
import mustache from "mustache"; | ||
|
||
import QGDSTemplate from "./src/js/qgds-template.js"; | ||
import QGDSComponent from "./src/js/qgds-component.js"; | ||
|
||
const breadcrumbs = QGDSComponent.make("breadcrumbs"); | ||
const banner = QGDSComponent.make("banner", { | ||
data: { | ||
breadcrumbs: breadcrumbs, | ||
title: "Register your vehicle or motorcycles", | ||
content: "Motor vehicles and motorcycles (including mopeds and tricycles) used on Queensland roads must be registered.", | ||
classes: "banner-default", | ||
} | ||
}); | ||
|
||
//Build a static content page with some components | ||
QGDSTemplate.make({ | ||
layout: "contentpage", // HTML template - similar to design file | ||
content: "main", // Primary content - similar to paint layout | ||
outfile: "index.html", // ...compiles into /dist/index.html | ||
theme: "", // adds a "data-bs-theme" attribute to the <html> tag | ||
banner: banner, // Banner component is compiled above using QDSComponent.make("banner", {...}) | ||
|
||
//Components that will be used on either the layout or content | ||
components: { | ||
inpagenav: QGDSComponent.make("inpagenav"), | ||
accordion: QGDSComponent.make("accordion"), | ||
|
||
// Different ways to load an alert: | ||
// 1. No datafile, no data | ||
// 2. Pass custom data object | ||
// 3. Pass datafile | ||
alerts: { | ||
closure: QGDSComponent.make("alert"), | ||
receipt: QGDSComponent.make("alert", { | ||
data: { | ||
classes: "alert-success", | ||
title: "Your transaction is complete", | ||
content: | ||
"<p>You're reference number is ATMR-1234-456. <a href='#'>Download a receipt</a></p>", | ||
}, | ||
}), | ||
reminder: QGDSComponent.make("alert", { | ||
datafile: "./src/components/alert/service-unavailable.json", | ||
}), | ||
}, | ||
|
||
button: QGDSComponent.make("button"), | ||
card: QGDSComponent.make("card"), | ||
table: QGDSComponent.make("table"), | ||
blockquote: QGDSComponent.make("blockquote"), | ||
callout: QGDSComponent.make("callout", { | ||
data: { | ||
title: "This is a callout title", | ||
content: "This is a callout description", | ||
classes: "mb-5", | ||
}, | ||
}), | ||
cardblock: QGDSComponent.make("cardblock", { | ||
path: "./src/components/card/cardblock.bs5.html", | ||
datafile: "./src/components/card/cardblock.data.json", | ||
}), | ||
}, | ||
}); | ||
|
||
console.log( | ||
`HTML template builds completed\n===============================\n` | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// PROJECT ESBUILD CONFIGURATION and BUILD FILE | ||
import * as esbuild from 'esbuild'; | ||
import * as path from 'path'; | ||
|
||
//Required libraries | ||
import {sassPlugin} from 'esbuild-sass-plugin'; | ||
import handlebarsPlugin from "esbuild-plugin-handlebars"; | ||
import postcss from 'postcss'; | ||
import autoprefixer from 'autoprefixer'; | ||
import { copy } from 'esbuild-plugin-copy'; | ||
|
||
// Configuration | ||
// https://esbuild.github.io/getting-started/#build-scripts | ||
|
||
const buildConfig = { | ||
outdir: './dist/', | ||
external: ['fs', 'path', "../img/*"], | ||
entryPoints: [ | ||
{ out: './assets/js/bootstrap.min', in: './node_modules/bootstrap/dist/js/bootstrap.js' }, | ||
{ out: './assets/js/main', in: './src/main.js' }, | ||
{ out: './assets/css/qld.bootstrap', in: './src/main.scss' }, | ||
], | ||
bundle: true, | ||
minify: false, | ||
loader: { | ||
'.html' : 'text', | ||
'.js': 'jsx', | ||
'.jpg': 'file', | ||
}, | ||
target: ['es6'], | ||
plugins: [ | ||
//Pass the following plugins to ESBuild to help with compiling | ||
// SASS processing, includes POSTCSS | ||
sassPlugin({ | ||
type: 'css', | ||
async transform(source) { | ||
const { css } = await postcss([autoprefixer]).process(source, { | ||
from: 'src/main.scss', | ||
to: 'dist/assets/css/qld.bootstrap.css', | ||
map: true | ||
}); | ||
return css; | ||
}, | ||
}), | ||
// Handlebars processing | ||
handlebarsPlugin(), | ||
|
||
// 1. Copy various files from /src to /dist as part of workflow. | ||
// 2. Copy files from /dist to /docs as part of workflow. | ||
copy({ | ||
// this is equal to process.cwd(), which means we use cwd path as base path to resolve `to` path | ||
// if not specified, this plugin uses ESBuild.build outdir/outfile options as base path. | ||
resolveFrom: 'cwd', | ||
assets: [ | ||
{ | ||
from: ['./src/templates/*.html'], | ||
to: ['./dist/'], | ||
}, | ||
{ | ||
from: ['./src/components/**/*.dxp.html'], | ||
to: ['./dist/components/dxp/'], | ||
}, | ||
{ | ||
from: ['./src/components/**/*.bs5.html'], | ||
to: ['./dist/components/bs5/'], | ||
}, | ||
{ | ||
from: ['./src/components/**/*.hbs.html'], | ||
to: ['./dist/components/dxp/'], | ||
}, | ||
{ | ||
from: ['./src/img/*'], | ||
to: ['./dist/assets/img'], | ||
}, | ||
{ | ||
from: ['./dist/**/*'], | ||
to: ['./docs/'], | ||
} | ||
], | ||
watch: true, | ||
}), | ||
] | ||
}; | ||
|
||
// Call esbuild's build() function with our configuration | ||
// This is the default project build function, it runs when we call "node build.js", or "npm run build" | ||
(async () => { | ||
await esbuild.build(buildConfig); | ||
console.log('⚡ Build successful ⚡'); | ||
})(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const server = Bun.serve({ | ||
port: Bun.env.port || 8000, | ||
fetch(req) { | ||
return new Response('Hello world 123') | ||
} | ||
}) | ||
|
||
console.log(`Listening on port ${server.port}`); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": ["ES6"], | ||
"target": "ES6", | ||
"module": "ES2015", | ||
"moduleResolution": "bundler", | ||
"moduleDetection": "force", | ||
"allowImportingTsExtensions": true, | ||
"noEmit": true, | ||
"composite": true, | ||
"strict": true, | ||
"downlevelIteration": true, | ||
"skipLibCheck": true, | ||
"allowSyntheticDefaultImports": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"allowJs": true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
git: | ||
git add . | ||
git commit -m "$m" | ||
git push -u origin main |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.