Commit bc0c4a40 authored by Christopher Fullarton's avatar Christopher Fullarton

Adds conditional asset builds based upon the required themes. Adds purifycss...

Adds conditional asset builds based upon the required themes. Adds purifycss for the theme files again since they do not contain output hashes and should work with the service worker
parent cbbe1f17
......@@ -79,11 +79,13 @@ generate_assets:
- cd dist
- angular-http-server --path browser/ --silent -p 4711 &
- cd browser/assets/jobs
- export themes='["Material","Material-blue","Material-hope","arsnova-dot-click-contrast","blackbeauty","decent-blue","elegant","GreyBlue-Lime","spiritual-purple"]'
- node GenerateMetaNodes.js --command=generateLinkImages --baseUrl=https://staging.arsnova.click
- node GenerateMetaNodes.js --command=generateManifest --baseUrl=https://staging.arsnova.click
- node --experimental-modules GenerateImages.mjs --command=generateLogoImages
- node --experimental-modules GenerateImages.mjs --command=generateFrontendPreview --host=http://localhost:4711 --root=true
- cd ../../../..
- npm run purify
- npm run compress
artifacts:
paths:
......@@ -142,11 +144,13 @@ generate_assets-beta:
- cd dist
- angular-http-server --path browser/ --silent -p 4711 &
- cd browser/assets/jobs
- export themes='["westermann-blue","blackbeauty"]'
- node GenerateMetaNodes.js --command=generateLinkImages --baseUrl=https://beta.arsnova.click
- node GenerateMetaNodes.js --command=generateManifest --baseUrl=https://beta.arsnova.click
- node --experimental-modules GenerateImages.mjs --command=generateLogoImages
- node --experimental-modules GenerateImages.mjs --command=generateFrontendPreview --host=http://localhost:4711 --root=true
- cd ../../../..
- npm run purify
- npm run compress
artifacts:
paths:
......
......@@ -32,7 +32,6 @@
"lint": "ng lint",
"e2e": "ng e2e --port 4201",
"purify": "node purifycss.js",
"postpurify": "npm run ngsw-config",
"compress": "gzip dist/browser/** -r --best --keep",
"http-startup": "angular-http-server dist/browser/ -p 4711",
"prod-test": "npm run build:PROD:DEPLOY && npm run http-startup",
......
......@@ -22,7 +22,7 @@ function fromDir(startPath, filter, callback) {
}
}
fromDir('./dist/browser', /\.css/, function (filename) {
fromDir('./dist/browser', /theme-.*\.css$/, function (filename) {
const content = ['./dist/browser/*.js', './dist/browser/*.html'];
const css = [filename];
......@@ -33,4 +33,4 @@ fromDir('./dist/browser', /\.css/, function (filename) {
};
console.log('-- found: ', filename);
purifycss(content, css, options);
});
\ No newline at end of file
});
......@@ -3,7 +3,7 @@ import fs from 'fs';
import sharp from 'sharp';
import derivates from './../imageDerivates.json';
import themeData from './../themeData.json';
import rawThemes from './../themeData.json';
import process from 'process';
import minimist from 'minimist';
import child_process from 'child_process';
......@@ -16,6 +16,13 @@ const languages = ['en', 'de', 'fr', 'it', 'es'];
const __dirname = path.resolve();
let themeData;
if (process.env.themes) {
themeData = JSON.parse(process.env.themes).map(t => rawThemes[t]);
} else {
themeData = rawThemes;
}
class GenerateImages {
constructor() {
......
......@@ -8,9 +8,16 @@ const mf = require('messageformat');
const argv = minimist(process.argv.slice(2));
const languages = ['en', 'de', 'fr', 'it', 'es'];
const themeData = require('./../themeData');
const rawThemes = require('./../themeData');
const imageDerivates = require('./../imageDerivates');
let themeData;
if (process.env.themes) {
themeData = JSON.parse(process.env.themes).map(t => rawThemes[t]);
} else {
themeData = rawThemes;
}
class GenerateMetaNodes {
constructor() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment