mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-12-18 02:40:34 +00:00
edd2f4ff85
Separating most LESS files into 2 ResourceLoader modules and a common folder: - skins.vector.styles - skins.vector.styles.legacy - common This changes aims to clearly separate the old (“legacy”), the new (“modern”) and the common styles which were previously all placed under `skins.vector.styles/`. Inside each directory are separate folders for `layouts` and `components`. The entry files, `skin.less` and `skin-legacy.less` are moved into the specific folders and a third, `common.less` entry file is created that contains the common imports for both old and new Vector. Aliases have been added to the Storybook Webpack config to avoid adding the story file changes to this patch. Images coming from CSS `url()`'s have also been temporarily disabled in Storybook until Storybook can be upgraded to use Webpack 5, and use array values for aliases, in a follow-up patch. This patch also slightly changes a footer layout specific rule so that existing `padding` remains unchanged in rendering due to new common and component structure. Bug: T264309 Change-Id: I1cd2681a2b61edb7be56c38f9bb3994827d7e322
80 lines
2.7 KiB
JavaScript
80 lines
2.7 KiB
JavaScript
const path = require( 'path' );
|
|
|
|
module.exports = {
|
|
resolve: {
|
|
alias: {
|
|
// FIXME: These imports should be updated in the story files instead of here.
|
|
'../resources/skins.vector.styles/Footer.less': '../resources/common/components/Footer.less',
|
|
'../resources/skins.vector.styles/LanguageButton.less': '../resources/skins.vector.styles/components/LanguageButton.less',
|
|
'../resources/skins.vector.styles/skin-legacy.less': '../resources/skins.vector.styles.legacy/skin-legacy.less',
|
|
'../resources/skins.vector.styles/Logo.less': '../resources/skins.vector.styles/components/Logo.less',
|
|
'../resources/skins.vector.styles/Menu.less': '../resources/common/components/Menu.less',
|
|
'../.storybook/common.less': '../resources/common/common.less',
|
|
'../resources/skins.vector.styles/MenuDropdown.less': '../resources/common/components/MenuDropdown.less',
|
|
'../resources/skins.vector.styles/MenuPortal.less': '../resources/common/components/MenuPortal.less',
|
|
'../resources/skins.vector.styles/MenuTabs.less': '../resources/common/components/MenuTabs.less',
|
|
'../resources/skins.vector.styles/TabWatchstarLink.less': '../resources/common/components/TabWatchstarLink.less',
|
|
'../resources/skins.vector.styles/SearchBox.less': '../resources/common/components/SearchBox.less',
|
|
'../resources/skins.vector.styles/Sidebar.less': '../resources/skins.vector.styles/components/Sidebar.less',
|
|
'../resources/skins.vector.styles/SidebarLogo.less': '../resources/common/components/SidebarLogo.less',
|
|
'../resources/skins.vector.styles/MenuPortal.less': '../resources/common/components/MenuPortal.less'
|
|
}
|
|
},
|
|
module: {
|
|
rules: [ {
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
// Beware of https://github.com/babel/babel-loader/issues/690. Changes to browsers require
|
|
// manual invalidation.
|
|
cacheDirectory: true
|
|
}
|
|
}
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: [ {
|
|
loader: 'style-loader'
|
|
}, {
|
|
loader: 'css-loader'
|
|
} ]
|
|
},
|
|
{
|
|
test: /\.(gif|png|jpe?g|svg)$/i,
|
|
loader: 'file-loader',
|
|
options: {
|
|
paths: [
|
|
path.resolve( __dirname, './resolve-imports' )
|
|
]
|
|
}
|
|
},
|
|
{
|
|
// in core some LESS imports don't specify filename
|
|
test: /\.less$/,
|
|
use: [ {
|
|
loader: 'style-loader'
|
|
}, {
|
|
loader: 'css-loader',
|
|
options: {
|
|
// FIXME: Disable resolving of CSS urls until Storybook is upgraded
|
|
// to use Webpack 5 and array values for aliases
|
|
// (which would cleanly resolve urls in LESS partial starting with `url(images/...)` )
|
|
url: false
|
|
}
|
|
}, {
|
|
loader: 'less-loader',
|
|
options: {
|
|
relativeUrls: true,
|
|
strictUnits: true,
|
|
paths: [
|
|
path.resolve( __dirname, 'resolve-imports' )
|
|
]
|
|
}
|
|
} ]
|
|
},
|
|
]
|
|
}
|
|
};
|