Skip to content

Commit ce1236d

Browse files
tobiasso85RandomByte
authored andcommitted
[INTERNAL] added compressJSON flag
1 parent 3aa1678 commit ce1236d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

lib/processors/themeBuilder.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ class ThemeBuilder {
3030
* @param {module:@ui5/fs.Resource[]} resources Library files
3131
* @param {Object} [options] Build options
3232
* @param {boolean} [options.compress=false] Compress build output (CSS / JSON)
33+
* @param {boolean} [options.compressJSON=false] Compress build output (JSON)
3334
* @returns {Promise<module:@ui5/fs.Resource[]>} Resolving with array of created files
3435
*/
35-
build(resources, {compress = false} = {}) {
36+
build(resources, {compress = false, compressJSON = false} = {}) {
3637
const files = [];
3738

3839
const compile = (resource) => {
@@ -67,7 +68,7 @@ class ThemeBuilder {
6768

6869
const libParams = new Resource({
6970
path: themeDir + "/library-parameters.json",
70-
string: JSON.stringify(result.variables, null, compress ? null : "\t")
71+
string: JSON.stringify(result.variables, null, compress || compressJSON ? null : "\t")
7172
});
7273

7374
files.push(libCss, libCssRtl, libParams);
@@ -99,13 +100,15 @@ class ThemeBuilder {
99100
* @param {module:@ui5/fs.Resource[]} parameters.resources List of <code>library.source.less</code> resources to be processed
100101
* @param {fs|module:@ui5/fs.fsInterface} parameters.fs Node fs or custom [fs interface]{@link module:resources/module:@ui5/fs.fsInterface}
101102
* @param {Object} [parameters.options] Options
102-
* @param {Object} [parameters.options.compress=false] Compress build output (CSS / JSON)
103+
* @param {boolean} [parameters.options.compress=false] Compress build output (CSS / JSON)
104+
* @param {boolean} [parameters.options.compressJSON=false] Compress build output (JSON)
103105
* @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving with theme resources
104106
*/
105107
module.exports = ({resources, fs, options}) => {
106108
const themeBuilder = new ThemeBuilder({fs});
107109
const compress = options && options.compress;
108-
return themeBuilder.build(resources, {compress}).then((files) => {
110+
const compressJSON = options && options.compressJSON;
111+
return themeBuilder.build(resources, {compress, compressJSON}).then((files) => {
109112
themeBuilder.clearCache();
110113
return files;
111114
});

lib/tasks/buildThemes.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ module.exports = async function({workspace, dependencies, options}) {
5959
}
6060
const processedResources = await themeBuilder({
6161
resources,
62-
fs: fsInterface(combo)
62+
fs: fsInterface(combo),
63+
options: {
64+
compressJSON: true
65+
}
6366
});
6467

6568
const compress = options.compress === undefined ? true : options.compress;

0 commit comments

Comments
 (0)