Browse Source

CSS is now embedded in simulator.js

master
Youen Toupin 3 years ago
parent
commit
4895ac2bb4
  1. 3
      simulator/src/simulator-ui.ts
  2. 16
      simulator/src/simulator.scss
  3. 1
      simulator/tools/embed.js
  4. 4
      simulator/tools/purify.js
  5. 1
      simulator/www/vhelio-simulator.html

3
simulator/src/simulator-ui.ts

@ -30,6 +30,9 @@ function runSimulation(parameters: SimulationParameters): Simulator.SimulationRe
} }
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
// Load CSS
document.getElementsByTagName('head')[0].innerHTML += (<any>window)['simulator.css'];
let container = document.getElementById('simulator'); let container = document.getElementById('simulator');
// Insert HTML code in the container // Insert HTML code in the container

16
simulator/src/simulator.scss

@ -26,3 +26,19 @@
@import "app.scss"; @import "app.scss";
} }
// Integration in a wordpress page
body.page {
#simulator {
width: 100%;
max-width: 100%;
button.delete {
padding: 0;
}
.select:not(.is-multiple):not(.is-loading)::after {
border: none; // wordpress has its own icon for select elements
}
}
}

1
simulator/tools/embed.js

@ -84,3 +84,4 @@ let intermediateDir = toolsDir + "/../.intermediate";
embedHtml(srcDir+'/simulator.html', intermediateDir+'/simulator.html.ts'); embedHtml(srcDir+'/simulator.html', intermediateDir+'/simulator.html.ts');
embedSvg(dataDir+'/climate-zones-map.svg', intermediateDir+'/climate-zones-map.svg.ts'); embedSvg(dataDir+'/climate-zones-map.svg', intermediateDir+'/climate-zones-map.svg.ts');
embedCsv(dataDir+'/climate-zones-data.csv', intermediateDir+'/climate-zones-data.ts'); embedCsv(dataDir+'/climate-zones-data.csv', intermediateDir+'/climate-zones-data.ts');
embedCss(intermediateDir+'/simulator.css', intermediateDir+'/simulator.css.ts');

4
simulator/tools/purify.js

@ -7,8 +7,8 @@ let content = ['./*.html'];
let css = ['../.intermediate/simulator.css']; let css = ['../.intermediate/simulator.css'];
let options = { let options = {
output: '../www/simulator.css', output: '../.intermediate/simulator.css',
whitelist: ['is-multiple', 'is-loading', 'is-narrow', 'is-active', 'climate-zone', 'grid-recharge', 'is-max-desktop', 'is-max-widescreen', 'line'], whitelist: ['is-multiple', 'is-loading', 'is-narrow', 'is-active', 'climate-zone', 'grid-recharge', 'is-max-desktop', 'is-max-widescreen', 'line', 'page'],
minify: false, minify: false,
info: false info: false
}; };

1
simulator/www/vhelio-simulator.html

@ -3,7 +3,6 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="simulator.css">
<style> <style>
html, body { html, body {

Loading…
Cancel
Save