mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
add support for static assets in theme folders
This commit is contained in:
@@ -5,26 +5,38 @@ const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const ScriptExtPlugin = require('script-ext-html-webpack-plugin');
|
||||
|
||||
export const copyWebpackOptions = [
|
||||
{
|
||||
from: path.join(__dirname, '..', 'node_modules', '@fortawesome', 'fontawesome-free', 'webfonts'),
|
||||
to: path.join('assets', 'fonts'),
|
||||
force: undefined
|
||||
},
|
||||
{
|
||||
from: path.join(__dirname, '..', 'src', 'assets', 'fonts'),
|
||||
to: path.join('assets', 'fonts')
|
||||
}, {
|
||||
from: path.join(__dirname, '..', 'src', 'assets', 'images'),
|
||||
to: path.join('assets', 'images')
|
||||
}, {
|
||||
from: path.join(__dirname, '..', 'src', 'assets', 'i18n'),
|
||||
to: path.join('assets', 'i18n')
|
||||
}, {
|
||||
from: path.join(__dirname, '..', 'src', 'robots.txt'),
|
||||
to: path.join('robots.txt')
|
||||
}
|
||||
];
|
||||
export const copyWebpackOptions = {
|
||||
patterns: [
|
||||
{
|
||||
from: path.join(__dirname, '..', 'node_modules', '@fortawesome', 'fontawesome-free', 'webfonts'),
|
||||
to: path.join('assets', 'fonts'),
|
||||
force: undefined
|
||||
},
|
||||
{
|
||||
from: path.join(__dirname, '..', 'src', 'assets'),
|
||||
to: 'assets',
|
||||
},
|
||||
{
|
||||
from: path.join(__dirname, '..', 'src', 'themes', '*', 'assets', '**', '*'),
|
||||
to: 'assets',
|
||||
noErrorOnMissing: true,
|
||||
transformPath(targetPath, absolutePath) {
|
||||
// use [\/|\\] to match both POSIX and Windows separators
|
||||
const matches = absolutePath.match(/.*[\/|\\]themes[\/|\\]([^\/|^\\]+)[\/|\\]assets[\/|\\](.+)$/);
|
||||
if (matches) {
|
||||
// matches[1] is the theme name
|
||||
// matches[2] is the rest of the path relative to the assets folder
|
||||
// e.g. themes/custom/assets/images/logo.png will end up in assets/custom/images/logo.png
|
||||
return path.join('assets', matches[1], matches[2]);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
from: path.join(__dirname, '..', 'src', 'robots.txt'),
|
||||
to: 'robots.txt'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const SCSS_LOADERS = [{
|
||||
loader: 'postcss-loader',
|
||||
@@ -40,7 +52,8 @@ const SCSS_LOADERS = [{
|
||||
includePaths: [projectRoot('./')]
|
||||
}
|
||||
}
|
||||
},]
|
||||
},
|
||||
];
|
||||
|
||||
export const commonExports = {
|
||||
plugins: [
|
||||
|
Reference in New Issue
Block a user