added css to rollup config

This commit is contained in:
Sebastian Speitel 2020-04-08 11:44:18 +02:00
parent 793ce4ca2d
commit fd8da4968c
5 changed files with 1462 additions and 3 deletions

3
.gitignore vendored
View File

@ -4,8 +4,9 @@ wetter/config/db.py
# JavaScript modules # JavaScript modules
node_modules node_modules
# JavaScript output # Bundle output
wetter/static/js wetter/static/js
wetter/static/css
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/

1433
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@
"@rollup/plugin-commonjs": "^11.0.2", "@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1", "@rollup/plugin-node-resolve": "^7.1.1",
"rollup": "^1.32.1", "rollup": "^1.32.1",
"rollup-plugin-scss": "^2.1.0",
"rollup-plugin-terser": "^5.3.0" "rollup-plugin-terser": "^5.3.0"
}, },
"dependencies": { "dependencies": {

View File

@ -1,15 +1,28 @@
import resolve from "@rollup/plugin-node-resolve"; import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs"; import commonjs from "@rollup/plugin-commonjs";
import { terser } from "rollup-plugin-terser"; import { terser } from "rollup-plugin-terser";
import css from "rollup-plugin-scss";
const production = process.env.NODE_ENV === "production"; const production = process.env.NODE_ENV === "production";
export default { const config = {
input: "wetter/static/wetter/js/wetter.js", input: "wetter/static/wetter/js/wetter.js",
output: { output: {
dir: "wetter/static/js", dir: "wetter/static/js",
format: "iife", format: "iife",
sourcemap: !production sourcemap: !production
}, },
plugins: [resolve(), commonjs(), !production && terser()] plugins: [
css({
output: "wetter/static/css/bundle.css",
outFile: "wetter/static/css/bundle.css",
outputStyle: production ? "compressed" : "expanded",
sourceMap: !production
}),
resolve(),
commonjs(),
production && terser()
]
}; };
export default [config];

View File

@ -1,9 +1,20 @@
import "bootstrap"; import "bootstrap";
import "../../../../node_modules/bootstrap/dist/css/bootstrap.css";
import "datatables"; import "datatables";
import "../../../../node_modules/datatables/media/css/jquery.dataTables.css";
import $ from "jquery"; import $ from "jquery";
import "leaflet"; import "leaflet";
import "../../../../node_modules/leaflet/dist/leaflet.css";
import "moment"; import "moment";
import "tempusdominus-bootstrap-4"; import "tempusdominus-bootstrap-4";
import "../../../../node_modules/tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.css";
import "../css/wetter.css";
// Entfernen des Clickoverlay wenn drauf geklickt wurde, #28 // Entfernen des Clickoverlay wenn drauf geklickt wurde, #28
$(".clickoverlay").on("click", function () { $(".clickoverlay").on("click", function () {