mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 21:13:07 +00:00
use config to determine active theme
This commit is contained in:
23
scripts/resolve-absolute-scss-imports.js
Normal file
23
scripts/resolve-absolute-scss-imports.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const replace = require('replace-in-file');
|
||||
const {
|
||||
projectRoot,
|
||||
} = require('../webpack/helpers');
|
||||
|
||||
/**
|
||||
* This script ensures you can use ~ to reference the project dir
|
||||
* in scss imports for AoT builds as well.
|
||||
*/
|
||||
|
||||
|
||||
const options = {
|
||||
files: projectRoot('build') + '/**/*.scss',
|
||||
from: /@import '~\//g,
|
||||
to: `@import '${projectRoot('./')}/`,
|
||||
};
|
||||
|
||||
try {
|
||||
replace.sync(options);
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Error occurred:', error);
|
||||
}
|
22
scripts/sync-build-dir.js
Normal file
22
scripts/sync-build-dir.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const syncBuildDir = require('copyfiles');
|
||||
const path = require('path');
|
||||
const {
|
||||
projectRoot,
|
||||
theme,
|
||||
themePath,
|
||||
} = require('../webpack/helpers');
|
||||
|
||||
const projectDepth = projectRoot('./').split(path.sep).length;
|
||||
|
||||
let callback;
|
||||
|
||||
if (theme !== null && theme !== undefined) {
|
||||
callback = () => {
|
||||
syncBuildDir([path.join(themePath, '**/*'), 'build'], { up: projectDepth + 2 }, () => {})
|
||||
}
|
||||
}
|
||||
else {
|
||||
callback = () => {};
|
||||
}
|
||||
|
||||
syncBuildDir([projectRoot('src/**/*'), 'build'], { up: projectDepth + 1 }, callback);
|
13
scripts/webpack.js
Normal file
13
scripts/webpack.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const path = require('path');
|
||||
const child_process = require('child_process');
|
||||
|
||||
const heapSize = 4096;
|
||||
const webpackPath = path.join('node_modules', 'webpack', 'bin', 'webpack.js');
|
||||
|
||||
const params = [
|
||||
'--max_old_space_size=' + heapSize,
|
||||
webpackPath,
|
||||
...process.argv.slice(2)
|
||||
];
|
||||
|
||||
child_process.spawn('node', params, { stdio:'inherit' });
|
Reference in New Issue
Block a user