Skip to content

Commit

Permalink
makes styles to be inlined on the page
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaiR committed Jan 26, 2019
1 parent 68f929c commit e8a5041
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ tasks.register("copyUi", Copy::class.java) {
group = "build"
description = "Copy UI files generated in :ui module to resources folder."
dependsOn(":ui:buildUi")
from("${project(":ui").projectDir}/src/main/webroot")
from("${project(":ui").projectDir}/src/main/dist/webroot")
into("src/main/resources/webroot")
}

Expand Down
18 changes: 11 additions & 7 deletions ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

minifyJs {
source = fileTree 'src/main/ui/script.js'
dest = file 'src/main/webroot/static/script.min.js'
dest = file 'src/main/dist/webroot/static/script.min.js'
closure {
compilerOptions.languageIn = 'ECMASCRIPT6_STRICT'
compilerOptions.languageOut = 'ECMASCRIPT5_STRICT'
Expand All @@ -14,7 +14,7 @@ minifyJs {

minifyCss {
source = fileTree 'src/main/ui/style.css'
dest = file 'src/main/webroot/static/style.min.css'
dest = file 'src/main/dist/style.min.css'
}

task buildUi {
Expand All @@ -25,14 +25,15 @@ task buildUi {

task copyAssets(type: Copy) {
group = 'build'
description = 'Copy static resources like images to "webroot/static" folder.'
description = 'Copy static resources like images to "dist/webroot/static" folder.'
from 'src/main/ui/space.png', 'src/main/ui/favicon.ico'
into 'src/main/webroot/static'
into 'src/main/dist/webroot/static'
}

task copyIndex(type: Copy) {
group = 'build'
description = 'Copy index.html file to "webroot" folder with replacing of special tokens with proper data.'
description = 'Copy index.html file to "dist/webroot" folder with replacing of special tokens with proper data.'
dependsOn 'minifyCss'
def currentTimeStamp = System.currentTimeMillis()
from('src/main/ui/index.html') {
filter {
Expand All @@ -41,12 +42,15 @@ task copyIndex(type: Copy) {
filter {
it.replace('@{revisions}', file("../.revisions").text.replaceAll('\n', ','))
}
filter {
it.replace('@{style}', file('src/main/dist/style.min.css').text)
}
}
into 'src/main/webroot'
into 'src/main/dist/webroot'
}

task cleanUi(type: Delete) {
group = 'build'
description = 'Clean up generated files.'
delete 'src/main/webroot'
delete 'src/main/dist'
}
2 changes: 1 addition & 1 deletion ui/src/main/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="icon" href="static/favicon.ico"/>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA==" crossorigin/>
<link rel="stylesheet" href="static/style.min.css?v=@{version}"/>
<script defer src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg==" crossorigin></script>
<script defer src="static/script.min.js?v=@{version}"></script>
<script>window.VERSION='@{version}';window.REVISIONS='@{revisions}';</script>
<style>@{style}</style>
</head>
<body>
<div id="map"></div>
Expand Down
14 changes: 5 additions & 9 deletions ui/src/main/ui/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ body {
background: black;
}

#map {
width: 100vw;
height: 100vh;
padding: 0;
margin: 0;
background: url("space.png");
html, body, #map {
height: 100%;
width: 100%;
}

.leaflet-control-layers-scrollbar {
overflow-y: hidden;
overflow-x: hidden;
#map {
background: url("static/space.png");
}

0 comments on commit e8a5041

Please sign in to comment.