From a70a62b701e71ec877d645b285f6d611f9d67035 Mon Sep 17 00:00:00 2001 From: Filip Leitner Date: Tue, 25 Feb 2025 13:46:04 +0100 Subject: [PATCH] build: Rename wo-bootstrap config to wagtail & remove icons as well --- angular.json | 4 ++-- package.json | 10 +++++----- ...slayers-wo-bootstrap.js => hslayers-wagtail-css.js} | 8 +++++++- 3 files changed, 14 insertions(+), 8 deletions(-) rename projects/hslayers/css/{hslayers-wo-bootstrap.js => hslayers-wagtail-css.js} (78%) diff --git a/angular.json b/angular.json index d170ab9882..0297f3a2b5 100644 --- a/angular.json +++ b/angular.json @@ -88,7 +88,7 @@ "projects/hslayers/css/hslayers-ng.scss" ] }, - "without-bootstrap": { + "wagtail": { "fileReplacements": [ { "replace": "projects/hslayers-app/src/environments/environment.ts", @@ -114,7 +114,7 @@ } ], "styles": [ - "dist/hslayers/css/hslayers-ng-wo-bootstrap.css" + "dist/hslayers/css/hslayers-ng-wagtail.css" ] }, "development": { diff --git a/package.json b/package.json index 6601632387..0da8386849 100644 --- a/package.json +++ b/package.json @@ -6,18 +6,18 @@ "start": "ng serve", "prebuild": "node projects/hslayers/prebuild.js", "build": "ng build hslayers --configuration production", - "prebuild-app-bs": "echo '⚠️ Building with Bootstrap... ⚠️'", - "prebuild-app": "echo '⚠️ Building WITHOUT Bootstrap... ⚠️'", - "build-app": "ng build hslayers-app --configuration without-bootstrap", + "prebuild-app-bs": "echo '⚠️ Building with Bootstrap & icons... ⚠️'", + "prebuild-app": "echo '⚠️ Building for Wagtail eg. WITHOUT Bootstrap and icons... ⚠️'", + "build-app": "ng build hslayers-app --configuration wagtail", "build-app-bs": "ng build hslayers-app --configuration bootstrap", "build-cesium": "ng build hslayers-cesium --configuration production", "build-cesium-app": "ng build hslayers-cesium-app --configuration production", "build-decoupling-app": "ng build decoupling-test-app --configuration production", "build-sensors": "ng build hslayers-sensors --configuration production", "prebuild-watch": "node projects/hslayers/prebuild.js", - "postbuild": "npm run build-css && npm run build-css-colors && npm run build-css-wo-bootstrap", + "postbuild": "npm run build-css && npm run build-css-colors && npm run build-css-wagtail", "build-css": "npx sass --load-path=node_modules projects/hslayers/css/hslayers-ng.scss dist/hslayers/css/hslayers-ng.css", - "build-css-wo-bootstrap": "node projects/hslayers/css/hslayers-wo-bootstrap.js", + "build-css-wagtail": "node projects/hslayers/css/hslayers-wagtail-css.js", "build-css-colors": "npx sass --load-path=node_modules projects/hslayers/css/hslayers-colors.scss dist/hslayers/css/hslayers-ng-colors.css", "start-test-app": "ng serve test-app --hmr", "start-decoupling-test-app": "ng serve decoupling-test-app --hmr", diff --git a/projects/hslayers/css/hslayers-wo-bootstrap.js b/projects/hslayers/css/hslayers-wagtail-css.js similarity index 78% rename from projects/hslayers/css/hslayers-wo-bootstrap.js rename to projects/hslayers/css/hslayers-wagtail-css.js index 7f53fe40f9..8aa9504f58 100644 --- a/projects/hslayers/css/hslayers-wo-bootstrap.js +++ b/projects/hslayers/css/hslayers-wagtail-css.js @@ -1,10 +1,15 @@ +/** + * This script compiles the HSLayers SCSS file to CSS without the Bootstrap imports and FONT AWESOME ICONS. + * This setup is necessary for the use on the Wagtail (preventing bootstrap duplication, icon overriding) + * The compiled CSS is saved to the dist folder. + */ const fs = require('fs'); const path = require('path'); const sass = require('sass'); // Paths to your SCSS files const inputFilePath = path.resolve(__dirname, './hslayers-ng.scss'); -const outputCssFilePath = path.resolve('dist/hslayers/css/hslayers-ng-wo-bootstrap.css'); +const outputCssFilePath = path.resolve('dist/hslayers/css/hslayers-ng-wagtail.css'); // Function to remove specific lines from the content @@ -21,6 +26,7 @@ const data = fs.readFileSync(inputFilePath, // Remove the lines containing Bootstrap imports let modifiedContent = removeLines(data, 33, 68); //Components modifiedContent = removeLines(modifiedContent, 16, 20); //Maps, mixins etx +modifiedContent = removeLines(modifiedContent, 2, 3) //ICONS // Compile the modified SCSS content to CSS const result = sass.compileString(modifiedContent, {