I am probably just confused about something, but for some reason I can't get URL rebase to work with .css files - only with .less files. If I rename a .css file to .less, it works.
I have setup a .less rule and a .css rule, where the only difference is running less-loader. Even if I let the .less rule also handle .css files it does not rebase the URLs for @imported .css files - it only works with .less files.
Any ideas what I'm doing wrong?
I have these two rules:
{
test: /\.less$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
url: false
}
},
{
loader: 'postcss-loader',
options: {
plugins: [
require('postcss-url')({
url: 'rebase',
assetsPath: root('dist')
})
]
}
},
{
loader: 'less-loader',
options: {
paths: [
rootDir
],
plugins: [
require('less-plugin-glob')
]
}
}
]
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
url: false,
}
},
{
loader: 'postcss-loader',
options: {
plugins: [
require('postcss-url')({
url: 'rebase',
assetsPath: root('dist')
})
]
}
}
]
}
And this is an example .less file I have as entry point in my webpack config.
my-styles.less
@import "../../Content/Themes/theme.css";
//@import "../../Content/Themes/theme.less"; // URL rebase works if I rename file to .less
I am probably just confused about something, but for some reason I can't get URL rebase to work with .css files - only with .less files. If I rename a .css file to .less, it works.
I have setup a
.lessrule and a.cssrule, where the only difference is runningless-loader. Even if I let the.lessrule also handle.cssfiles it does not rebase the URLs for@imported.cssfiles - it only works with.lessfiles.Any ideas what I'm doing wrong?
I have these two rules:
And this is an example
.lessfile I have as entry point in my webpack config.my-styles.less