initial commit

This commit is contained in:
2024-03-01 06:05:38 +08:00
commit 46231b3f73
19 changed files with 816 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
plugins {
alias(catalog.plugins.kotlin.multiplatform)
alias(catalog.plugins.kotlin.serialization)
}
kotlin {
sourceSets {
jsMain {
dependencies {
implementation catalog.kotlin.serialization.json
implementation rootProject
implementation(npm("bootstrap", "5.3.2"))
implementation(npm("bootstrap-icons", "1.11.3"))
implementation(npm("style-loader", "3.3.4"))
implementation(npm("css-loader", "6.10.0"))
implementation(npm("postcss-loader", "8.1.0"))
implementation(npm("sass", "1.71.1"))
implementation(npm("sass-loader", "14.1.1"))
implementation(npm("autoprefixer", "10.4.17"))
}
}
}
js(IR) {
browser {
runTask {
sourceMaps = true
devServer.port = 8080
// cssSupport {
// enabled.set(true)
// }
}
webpackTask {
sourceMaps = false
}
}
binaries.executable()
}
}

View File

@@ -0,0 +1,105 @@
package net.woggioni.khtml.example
import kotlinx.browser.document
import net.woggioni.khtml.Khtml
import org.w3c.dom.HTMLElement
@JsModule("bootstrap")
external val bootstrap : dynamic
fun main(vararg args: String) {
js("require ('./scss/styles.scss');")
Khtml.of(document, document.body as HTMLElement) {
main {
div {
h1 {
text("Hello, Bootstrap and Webpack!")
}
button {
classes("btn", "btn-primary")
text("Primary button")
}
}
div {
classes("container")
div {
classes("row")
table {
classes("table")
thead {
tr {
th {
attr("scope", "col")
text("#")
}
th {
attr("scope", "col")
text("First")
}
th {
attr("scope", "col")
text("Last")
}
th {
attr("scope", "col")
text("Handle")
}
}
}
tbody {
tr {
th {
attr("scope", "row")
text("1")
}
td {
attr("scope", "col")
text("Mark")
}
td {
attr("scope", "col")
text("Otto")
}
td {
attr("scope", "col")
text("@mdo")
}
}
tr {
th {
attr("scope", "row")
text("2")
}
td {
attr("scope", "col")
text("Jacob")
}
td {
attr("scope", "col")
text("Thornton")
}
td {
attr("scope", "col")
text("@fat")
}
}
tr {
th {
attr("scope", "row")
text("2")
}
td {
attr("colspan", "2")
text("Larry the Bird")
}
td {
attr("scope", "col")
text("@twitter")
}
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="css/jpacrepo.css"/>
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">-->
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"-->
<!-- rel="stylesheet"-->
<!-- integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN"-->
<!-- crossorigin="anonymous"/>-->
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"-->
<!-- integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"-->
<!-- crossorigin="anonymous"></script>-->
<script src="khtml-example.js" defer="true"></script>
<title>Hello World!</title>
</head>
</html>

View File

@@ -0,0 +1 @@
@import "bootstrap/scss/bootstrap";

View File

@@ -0,0 +1,3 @@
config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, type: 'asset'});
config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, type: 'asset'});
config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, type: 'asset/resource'});

View File

@@ -0,0 +1 @@
config.module.rules.push({ test: /\.css$/, use: ["style-loader", { loader: "css-loader", options: {sourceMap: false} } ] });

View File

@@ -0,0 +1,2 @@
config.module.rules.push({ test: /\.s[ac]ss$/, use: ["style-loader", { loader: "css-loader", options: {sourceMap: false} }, "sass-loader" ] });