mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Add support for dynamic themes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { buildRoot, globalCSSImports, projectRoot, themedTest, themedUse, themePath } from './helpers';
|
||||
import { globalCSSImports, projectRoot } from './helpers';
|
||||
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const path = require('path');
|
||||
@@ -26,11 +26,27 @@ export const copyWebpackOptions = [
|
||||
}
|
||||
];
|
||||
|
||||
const SCSS_LOADERS = [{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: true
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
sassOptions: {
|
||||
includePaths: [projectRoot('./')]
|
||||
}
|
||||
}
|
||||
},]
|
||||
|
||||
export const commonExports = {
|
||||
plugins: [
|
||||
new CopyWebpackPlugin(copyWebpackOptions),
|
||||
new HtmlWebpackPlugin({
|
||||
template: buildRoot('./index.html', ),
|
||||
template: projectRoot('./src/index.html', ),
|
||||
output: projectRoot('dist'),
|
||||
inject: 'head'
|
||||
}),
|
||||
@@ -40,14 +56,6 @@ export const commonExports = {
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: (filePath) => themedTest(filePath, 'scss'),
|
||||
use: (info) => themedUse(info.resource, 'scss')
|
||||
},
|
||||
{
|
||||
test: (filePath) => themedTest(filePath, 'html'),
|
||||
use: (info) => themedUse(info.resource, 'html')
|
||||
},
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: '@ngtools/webpack'
|
||||
@@ -56,19 +64,10 @@ export const commonExports = {
|
||||
test: /\.scss$/,
|
||||
exclude: [
|
||||
/node_modules/,
|
||||
buildRoot('styles/_exposed_variables.scss'),
|
||||
buildRoot('styles/_variables.scss')
|
||||
/(_exposed)?_variables.scss$|\/src\/themes\/[^/]+\/styles\/.+.scss$/
|
||||
],
|
||||
use: [
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
sassOptions: {
|
||||
includePaths: [projectRoot('./'), path.join(themePath, 'styles')]
|
||||
}
|
||||
}
|
||||
},
|
||||
...SCSS_LOADERS,
|
||||
{
|
||||
loader: 'sass-resources-loader',
|
||||
options: {
|
||||
@@ -78,24 +77,10 @@ export const commonExports = {
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /(_exposed)?_variables.scss$/,
|
||||
test: /(_exposed)?_variables.scss$|\/src\/themes\/[^/]+\/styles\/.+.scss$/,
|
||||
exclude: [/node_modules/],
|
||||
use: [
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: true
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
sassOptions: {
|
||||
includePaths: [projectRoot('./'), path.join(themePath, 'styles')]
|
||||
}
|
||||
}
|
||||
}
|
||||
...SCSS_LOADERS,
|
||||
]
|
||||
},
|
||||
],
|
||||
|
Reference in New Issue
Block a user