diff --git a/package.json b/package.json index 35da7c6f5d..31d629effc 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "prebuild:aot": "yarn run prebuild", "prebuild:prod": "yarn run prebuild", "build": "node ./scripts/webpack.js --progress --mode development", - "build:aot": "yarn run syncbuilddir && node ./scripts/resolve-absolute-scss-imports.js && node ./scripts/webpack.js --env.aot --env.server --mode development && node ./scripts/webpack.js --env.aot --env.client --mode development", - "build:prod": "yarn run syncbuilddir && node ./scripts/resolve-absolute-scss-imports.js && node ./scripts/webpack.js --env.aot --env.server --mode production && node ./scripts/webpack.js --env.aot --env.client --mode production", + "build:aot": "yarn run syncbuilddir && node ./scripts/webpack.js --env.aot --env.server --mode development && node ./scripts/webpack.js --env.aot --env.client --mode development", + "build:prod": "yarn run syncbuilddir && node ./scripts/webpack.js --env.aot --env.server --mode production && node ./scripts/webpack.js --env.aot --env.client --mode production", "postbuild:prod": "yarn run rollup", "rollup": "rollup -c rollup.config.js", "prestart": "yarn run build:prod", diff --git a/scripts/resolve-absolute-scss-imports.js b/scripts/resolve-absolute-scss-imports.js deleted file mode 100644 index 5671d445f3..0000000000 --- a/scripts/resolve-absolute-scss-imports.js +++ /dev/null @@ -1,24 +0,0 @@ -const replace = require('replace-in-file'); -const path = require('path'); -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: path.join(projectRoot('build'), '**', '*.scss'), - from: /@import '~\/([^']+)/g, - to: `@import '${path.join(projectRoot('./'), '$1')}`, -}; - -try { - replace.sync(options); -} -catch (error) { - console.error('Error occurred:', error); -} diff --git a/themes/mantis/app/+home-page/home-news/home-news.component.scss b/themes/mantis/app/+home-page/home-news/home-news.component.scss index a9c2f8eed5..c693e9a493 100644 --- a/themes/mantis/app/+home-page/home-news/home-news.component.scss +++ b/themes/mantis/app/+home-page/home-news/home-news.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+home-page/home-news/home-news.component.scss'; +@import 'src/app/+home-page/home-news/home-news.component.scss'; $home-news-link-color: $green !default; $home-news-link-color: darken($home-news-link-color, 15%) !default; diff --git a/themes/mantis/app/+home-page/home-page.component.scss b/themes/mantis/app/+home-page/home-page.component.scss index ea50989878..64bd786cd5 100644 --- a/themes/mantis/app/+home-page/home-page.component.scss +++ b/themes/mantis/app/+home-page/home-page.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+home-page/home-page.component.scss'; +@import 'src/app/+home-page/home-page.component.scss'; div.background-image { color: white; diff --git a/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss b/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss index a307fca0e9..7ce24acc15 100644 --- a/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss +++ b/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss'; +@import 'src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss'; :host { > * { diff --git a/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss b/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss index eb41652261..ab1bc700b1 100644 --- a/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss +++ b/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss'; +@import 'src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss'; :host { > * { diff --git a/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.scss b/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.scss index 8c2cb20a4d..6d97cbf5c3 100644 --- a/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.scss +++ b/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+item-page/simple/item-types/journal/journal.component.scss'; +@import 'src/app/+item-page/simple/item-types/journal/journal.component.scss'; :host { > * { diff --git a/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.scss b/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.scss index 956888ed74..5b2bdb0382 100644 --- a/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.scss +++ b/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+item-page/simple/item-types/orgunit/orgunit.component.scss'; +@import 'src/app/+item-page/simple/item-types/orgunit/orgunit.component.scss'; :host { > * { diff --git a/themes/mantis/app/+item-page/simple/item-types/person/person.component.scss b/themes/mantis/app/+item-page/simple/item-types/person/person.component.scss index 3958f00fc8..3b454aab0e 100644 --- a/themes/mantis/app/+item-page/simple/item-types/person/person.component.scss +++ b/themes/mantis/app/+item-page/simple/item-types/person/person.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+item-page/simple/item-types/person/person.component.scss'; +@import 'src/app/+item-page/simple/item-types/person/person.component.scss'; :host { > * { diff --git a/themes/mantis/app/+item-page/simple/item-types/project/project.component.scss b/themes/mantis/app/+item-page/simple/item-types/project/project.component.scss index 372b79cbca..9c9aa9c629 100644 --- a/themes/mantis/app/+item-page/simple/item-types/project/project.component.scss +++ b/themes/mantis/app/+item-page/simple/item-types/project/project.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+item-page/simple/item-types/project/project.component.scss'; +@import 'src/app/+item-page/simple/item-types/project/project.component.scss'; :host { > * { diff --git a/themes/mantis/app/+item-page/simple/item-types/publication/publication.component.scss b/themes/mantis/app/+item-page/simple/item-types/publication/publication.component.scss index 0c47ac24e9..f65d9a00d5 100644 --- a/themes/mantis/app/+item-page/simple/item-types/publication/publication.component.scss +++ b/themes/mantis/app/+item-page/simple/item-types/publication/publication.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+item-page/simple/item-types/publication/publication.component.scss'; +@import 'src/app/+item-page/simple/item-types/publication/publication.component.scss'; :host { > * { diff --git a/themes/mantis/app/+search-page/search-filters/search-filter/search-filter.component.scss b/themes/mantis/app/+search-page/search-filters/search-filter/search-filter.component.scss index 00a7442eed..8e9b1d32b1 100644 --- a/themes/mantis/app/+search-page/search-filters/search-filter/search-filter.component.scss +++ b/themes/mantis/app/+search-page/search-filters/search-filter/search-filter.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+search-page/search-filters/search-filter/search-filter.component.scss'; +@import 'src/app/+search-page/search-filters/search-filter/search-filter.component.scss'; .facet-filter { background-color: map-get($theme-colors, light); diff --git a/themes/mantis/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss b/themes/mantis/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss index 6d3ad5f766..42b8e0205b 100644 --- a/themes/mantis/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss +++ b/themes/mantis/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss'; +@import 'src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss'; ::ng-deep .noUi-connect { background: $info; diff --git a/themes/mantis/app/+search-page/search-settings/search-settings.component.scss b/themes/mantis/app/+search-page/search-settings/search-settings.component.scss index b99d36a889..602c8ca4c3 100644 --- a/themes/mantis/app/+search-page/search-settings/search-settings.component.scss +++ b/themes/mantis/app/+search-page/search-settings/search-settings.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/+search-page/search-settings/search-settings.component.scss'; +@import 'src/app/+search-page/search-settings/search-settings.component.scss'; .setting-option { background-color: map-get($theme-colors, light); diff --git a/themes/mantis/app/navbar/navbar.component.scss b/themes/mantis/app/navbar/navbar.component.scss index 80cc462c47..1417acff59 100644 --- a/themes/mantis/app/navbar/navbar.component.scss +++ b/themes/mantis/app/navbar/navbar.component.scss @@ -1,4 +1,4 @@ -@import '~/src/app/navbar/navbar.component.scss'; +@import 'src/app/navbar/navbar.component.scss'; nav.navbar { border-bottom: 5px $green solid; diff --git a/webpack/helpers.js b/webpack/helpers.js index 040887c70a..8bc12495ce 100644 --- a/webpack/helpers.js +++ b/webpack/helpers.js @@ -63,18 +63,6 @@ const globalCSSImports = (env) => { return [ buildRoot('styles/_mixins.scss', env), ]}; -const themeReplaceOptions = - { - multiple: [ - { - search: '@import \'~/([^\']+)', - replace: '@import \'' + path.join(projectRoot('./'), '$1'), - flags: 'g' - } - ] - }; - - const getThemedPath = (componentPath, ext) => { const parsedPath = path.parse(componentPath); const relativePath = path.relative(srcPath, parsedPath.dir); @@ -114,6 +102,5 @@ module.exports = { getThemedPath, themedTest, themedUse, - globalCSSImports, - themeReplaceOptions + globalCSSImports }; diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js index 4eec4f46fb..5177984c61 100644 --- a/webpack/webpack.common.js +++ b/webpack/webpack.common.js @@ -4,7 +4,6 @@ const { projectRoot, buildRoot, globalCSSImports, - themeReplaceOptions, themePath, themedTest, themedUse @@ -95,7 +94,7 @@ module.exports = (env) => { loader: 'sass-loader', options: { sourceMap: true, - includePaths: [path.join(themePath, 'styles')] + includePaths: [projectRoot('./'), path.join(themePath, 'styles')] } }, { @@ -103,10 +102,6 @@ module.exports = (env) => { options: { resources: globalCSSImports(env) }, - }, - { - loader: 'string-replace-loader', - options: themeReplaceOptions } ] }, @@ -137,12 +132,8 @@ module.exports = (env) => { loader: 'sass-loader', options: { sourceMap: true, - includePaths: [path.join(themePath, 'styles')] + includePaths: [projectRoot('./'), path.join(themePath, 'styles')] } - }, - { - loader: 'string-replace-loader', - options: themeReplaceOptions } ] }, diff --git a/webpack/webpack.test.js b/webpack/webpack.test.js index a3036146e2..83e6e44e79 100644 --- a/webpack/webpack.test.js +++ b/webpack/webpack.test.js @@ -4,8 +4,7 @@ const { themedTest, themedUse, themePath, - globalCSSImports, - themeReplaceOptions + globalCSSImports } = require('./helpers'); const path = require('path'); @@ -171,7 +170,7 @@ module.exports = function (env) { loader: 'sass-loader', options: { sourceMap: true, - includePaths: [path.join(themePath, 'styles')] + includePaths: [projectRoot('./'), path.join(themePath, 'styles')] } }, { @@ -179,10 +178,6 @@ module.exports = function (env) { options: { resources: globalCSSImports(env) }, - }, - { - loader: 'string-replace-loader', - options: themeReplaceOptions } ] }, @@ -213,12 +208,8 @@ module.exports = function (env) { loader: 'sass-loader', options: { sourceMap: true, - includePaths: [path.join(themePath, 'styles')] + includePaths: [projectRoot('./'), path.join(themePath, 'styles')] } - }, - { - loader: 'string-replace-loader', - options: themeReplaceOptions } ] },