mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 09:56:37 +02:00
🎉 Make the build to be config independent.
Loading the configuration dinamically using global variables defined in index.html.
This commit is contained in:
parent
1ce46a0ef8
commit
c09f281f58
6 changed files with 38 additions and 21 deletions
|
@ -100,6 +100,16 @@ function readLocales() {
|
|||
return JSON.stringify(result);
|
||||
}
|
||||
|
||||
function readConfig() {
|
||||
const apiUrl = process.env.UXBOX_API_URL;
|
||||
const demoWarn = process.env.UXBOX_DEMO_WARNING;
|
||||
|
||||
return JSON.stringify({
|
||||
apiUrl: (apiUrl === undefined ? "http://localhost:6060" : apiUrl.trim()),
|
||||
demoWarning: demoWarn === "true",
|
||||
});
|
||||
}
|
||||
|
||||
function templatePipeline(options) {
|
||||
return function() {
|
||||
const input = options.input;
|
||||
|
@ -108,11 +118,13 @@ function templatePipeline(options) {
|
|||
|
||||
const locales = readLocales();
|
||||
const icons = readSvgSprite();
|
||||
const config = readConfig();
|
||||
|
||||
const tmpl = mustache({
|
||||
ts: ts,
|
||||
ic: icons,
|
||||
tr: JSON.stringify(locales),
|
||||
config: JSON.stringify(config),
|
||||
translations: JSON.stringify(locales),
|
||||
});
|
||||
|
||||
return gulp.src(input)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue