Skip to content

Commit

Permalink
allow usage of Common.css/FooBar.less files
Browse files Browse the repository at this point in the history
  • Loading branch information
FO-nTTaX committed Jan 23, 2024
1 parent 7e1eaf3 commit 56e3115
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ResourceLoader/ResourceLoaderArticlesModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function getPages( ResourceLoaderContext $context ) {
foreach ( $articles as $article ) {
if ( substr( $article, -3 ) === '.js' ) {
$pages[ 'MediaWiki:Common.js/' . $article ] = [ 'type' => 'script' ];
} elseif ( substr( $article, -4 ) === '.css' ) {
} elseif ( substr( $article, -4 ) === '.css' || substr( $article, -5 ) === '.less' ) {
$pages[ 'MediaWiki:Common.css/' . $article ] = [ 'type' => 'style' ];
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/SpecialPage/SpecialResourceLoaderArticles.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ public function addPageCB( $formData ) {
);
$store = false;
} elseif (
( substr( $formData[ 'Page' ], -4 ) !== '.css' && $formData[ 'Type' ] === 'style' )
(
( substr( $formData[ 'Page' ], -4 ) !== '.css' || substr( $formData[ 'Page' ], -5 ) !== '.less' )
&& $formData[ 'Type' ] === 'style'
)
|| ( substr( $formData[ 'Page' ], -3 ) !== '.js' && $formData[ 'Type' ] === 'script' )
) {
$output->addWikiTextAsContent(
Expand Down Expand Up @@ -236,7 +239,10 @@ public function editPageCB( $formData ) {
);
$store = false;
} elseif (
( substr( $formData[ 'Page' ], -4 ) !== '.css' && $formData[ 'Type' ] === 'style' )
(
( substr( $formData[ 'Page' ], -4 ) !== '.css' || substr( $formData[ 'Page' ], -5 ) !== '.less' )
&& $formData[ 'Type' ] === 'style'
)
|| ( substr( $formData[ 'Page' ], -3 ) !== '.js' && $formData[ 'Type' ] === 'script' )
) {
$output->addWikiTextAsContent(
Expand Down

0 comments on commit 56e3115

Please sign in to comment.