add projectroot to sass includedPaths instead of using replace to fix the paths during build

This commit is contained in:
Art Lowel
2019-06-05 17:14:22 +02:00
parent 56b2ee1f0d
commit 743be6a2cd
18 changed files with 21 additions and 76 deletions

View File

@@ -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
};

View File

@@ -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
}
]
},

View File

@@ -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
}
]
},