Skip to content

Commit

Permalink
automatically set CSS content model for .less files in NS_MEDIAWIKI
Browse files Browse the repository at this point in the history
  • Loading branch information
FO-nTTaX committed Jan 25, 2024
1 parent 41bed5f commit a5d6fc9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"Hooks": {
"BeforePageDisplay": "Main",
"ContentHandlerDefaultModelForHook": "Main",
"ContentHandlerDefaultModelFor": "Main",
"LoadExtensionSchemaUpdates": "Schema",
"MakeGlobalVariablesScript": "Main",
"ResourceLoaderRegisterModules": "Main"
Expand Down
3 changes: 2 additions & 1 deletion src/Hooks/MainHookHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public function onBeforePageDisplay( $out, $skin ): void {
public function onContentHandlerDefaultModelFor( $title, &$model ) {
if ( $title->getNamespace() === NS_MEDIAWIKI ) {
if ( str_ends_with( $title->getText(), '.less' ) ) {
$model = CONTENT_MODEL_JSON;
$model = CONTENT_MODEL_CSS;
return true;
}
}
}
Expand Down

0 comments on commit a5d6fc9

Please sign in to comment.