Skip to content

Commit

Permalink
Initial integration of lit for admin (#1353)
Browse files Browse the repository at this point in the history
* initial integration of vite + lit for new admin

icon tests

font size reset

link to vscode plugin

* add static build support

* fixes static resources handling
  • Loading branch information
syjer committed May 13, 2024
1 parent 1cc53b7 commit e6473c9
Show file tree
Hide file tree
Showing 14 changed files with 1,515 additions and 3 deletions.
14 changes: 14 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,19 @@ tasks.register('frontendBuild', NpmTask) {
outputs.dir("${project.projectDir}/frontend/dist")
}

tasks.register('frontendAdminNpmInstall', NpmTask) {
args = ['--prefix', "${project.projectDir}/frontend/admin", 'ci']
}

tasks.register('frontendAdminBuild', NpmTask) {
dependsOn frontendAdminNpmInstall
args = ['--prefix', "${project.projectDir}/frontend/admin", 'run', 'build']
outputs.dir("${project.projectDir}/frontend/admin/dist")
}

clean.doFirst {
delete "${project.projectDir}/frontend/dist"
delete "${project.projectDir}/frontend/admin/dist"
}

tasks.register('publicFrontendIndexTransform', FrontendIndexTransformTask) {
Expand Down Expand Up @@ -429,6 +440,9 @@ bootJar {
from(tasks.named("frontendBuild")) {
into 'BOOT-INF/classes/resources/'
}
from(tasks.named("frontendAdminBuild")) {
into 'BOOT-INF/classes/resources/alfio-admin-frontend/'
}
from(tasks.named("publicFrontendIndexTransform")) {
rename 'alfio-public-frontend-index.html', 'BOOT-INF/classes/alfio-public-frontend-index.html'
}
Expand Down
24 changes: 24 additions & 0 deletions frontend/admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
23 changes: 23 additions & 0 deletions frontend/admin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#Frontend for admin

Use lit element + shoelace style.

Created with vite: `npm create vite@latest admin -- --template lit-ts`

See https://vitejs.dev/guide/backend-integration.html

See https://stackoverflow.com/a/76446465 for icon/static assets

## run dev server

`npm run dev`

Then you can launch alf.io normally and go to localhost:8080/admin/ -> all the components exported in the main.ts will be available.

## todo

- find a decent way to inline the icons as data uri

## vscode plugins

- https://marketplace.visualstudio.com/items?itemName=runem.lit-plugin

0 comments on commit e6473c9

Please sign in to comment.