Skip to content

Commit 2e3d994

Browse files
committed
Make :demo's desktop app and web app run
The icons are not shown in the web app.
1 parent 52f048d commit 2e3d994

File tree

8 files changed

+1051
-22
lines changed

8 files changed

+1051
-22
lines changed

compose-multiplatform-material/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,18 @@ kotlin {
2323
}
2424
named("jsMain") {
2525
dependencies {
26+
// copied from https://github.com/mpetuska/kmdc
27+
2628
// Be lazy and use the shortcut
2729
implementation("dev.petuska:kmdc:0.0.5")
2830
implementation("dev.petuska:kmdcx:0.0.5")
2931
// TODO: pick and choose exact components to reduce bundle size
32+
33+
// SCSS dependencies
34+
implementation(devNpm("style-loader", "^3.3.1"))
35+
implementation(devNpm("css-loader", "^6.7.1"))
36+
implementation(devNpm("sass-loader", "^13.0.0"))
37+
implementation(devNpm("sass", "^1.52.1"))
3038
}
3139
}
3240
}

demo/build.gradle.kts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ plugins {
33
}
44

55
kotlin {
6-
js(IR) { browser() }
6+
js(IR) {
7+
browser {
8+
commonWebpackConfig {
9+
outputFileName = "app.js"
10+
}
11+
}
12+
binaries.executable()
13+
}
714

815
sourceSets {
916
named("commonMain") {
@@ -17,5 +24,24 @@ kotlin {
1724
implementation(compose.desktop.currentOs)
1825
}
1926
}
27+
/* TODO: uncomment or remove
28+
named("jsMain") {
29+
dependencies {
30+
// copied from https://github.com/mpetuska/kmdc
31+
32+
// SCSS dependencies
33+
implementation(devNpm("style-loader", "^3.3.1"))
34+
implementation(devNpm("css-loader", "^6.7.1"))
35+
implementation(devNpm("sass-loader", "^13.0.0"))
36+
implementation(devNpm("sass", "^1.52.1"))
37+
}
38+
}
39+
*/
40+
}
41+
}
42+
43+
compose.desktop {
44+
application {
45+
mainClass = "com.huanshankeji.compose.material.demo.MainKt"
2046
}
2147
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
package com.huanshankeji.compose.material.demo
22

3-
fun main() {
4-
// TODO
5-
}
3+
expect fun main()
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.huanshankeji.compose.material.demo
2+
3+
import org.jetbrains.compose.web.renderComposableInBody
4+
5+
actual fun main() {
6+
renderComposableInBody { App() }
7+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6+
<meta charset="UTF-8">
7+
<title>Compose Multiplatform Material demo</title>
8+
</head>
9+
10+
<body>
11+
<script src="app.js"></script>
12+
</body>
13+
14+
</html>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.huanshankeji.compose.material.demo
2+
3+
import androidx.compose.ui.window.Window
4+
import androidx.compose.ui.window.application
5+
6+
actual fun main() = application {
7+
Window(::exitApplication) {
8+
App()
9+
}
10+
}

demo/webpack.config.d/scss.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// copied from https://github.com/mpetuska/kmdc/blob/master/gradle/webpack.config.d/scss.js
2+
3+
config.module.rules.push({
4+
test: /\.(scss|sass)$/,
5+
use: [
6+
/**
7+
* fallback to style-loader in development
8+
* "style-loader" creates style nodes from JS strings
9+
*/
10+
"style-loader", // translates CSS into CommonJS
11+
"css-loader", // translates CSS into CommonJS
12+
"sass-loader" // compiles Sass to CSS, using Node Sass by default
13+
]
14+
});
15+
config.module.rules.push({
16+
test: /\.css$/,
17+
use: [
18+
/**
19+
* fallback to style-loader in development
20+
* "style-loader" creates style nodes from JS strings
21+
*/
22+
"style-loader", // translates CSS into CommonJS
23+
"css-loader", // translates CSS into CommonJS
24+
]
25+
});

0 commit comments

Comments
 (0)