Extensão: CSS
Estado de lançamento: estável |
|
|---|---|
| Implementação | Função do analisador |
| Descrição | Proporciona uma função de analisador para adicionar ficheiros CSS, artigos ou regras em linha nos artigos. |
| Autor(es) | |
| Última versão | 3.5.0 |
| MediaWiki | >= 1.43.0 |
|
|
| License | GNU General Public License 2.0 or later |
| Transferência | |
| Exemplo | organicdesign.nz |
| Traduza a extensão CSS se esta estiver disponível em translatewiki.net | |
| Problemas | Tarefas em aberto · Reportar um erro |
A extensão CSS permite que sejam incluídas folhas de estilo CSS em artigos específicos. CSS pode ser outro artigo, um ficheiro ou pode ser regras definidas diretamente na função do analisador.
Utilização
For example, if you have a CSS article called "MyStyles.css", which are the styles intended for use with the article "MyFancyUserPage", you would add the following parser-function syntax to the latter,
{{#css:MyStyles.css}}
If on the other hand "MyStyles.css" was a file in the /wiki/skins directory, then it would be included as shown below. Note that the file must be an absolute path with a leading slash to distinguish it from an article title.
{{#css:/skins/MyStyles.css}}
Alternatively, CSS rules can be directly included within the parser-function (inline) as in the following example,
{{#css:
body {
background: yellow;
color: red;
font-size: 1.25rem;
}
}}
Instalação
- Exporte e coloque o ficheiro, ou ficheiros, num diretório chamado
CSS, na sua pastaextensions/.
Developers and code contributors should install the extension from Git instead, using:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CSS
- Only when installing from Git, run Composer to install PHP dependencies, by issuing
composer install --no-devin the extension directory. (See T173141 for potential complications.) - Acrescente o seguinte código ao fundo do ficheiro $LocalSettings:
wfLoadExtension( 'CSS' );
- Configure conforme necessário.
Pronto – Na página especial Special:Version da sua wiki verifique se a extensão foi instalada.
Configuração
Optionally, you can set the base URL for external files.
$wgCSSPath = false; # Default, relative to $wgScriptPath
$wgCSSPath = ''; # Relative to the root of your server
$wgCSSPath = 'https://example.org/stylesheets'; # Relative to a different site
Tips
- == Problemas com a alteração da cor ou fundo de uma página específica ==
Using the parser function to use the CSS from another page does not work to change the color or background of the page, however, using the parser function on a single page by itself does allow the background to be changed. To overcome this problem, it is possible to load the CSS through transclusion, which does not cause the problem of failing to load the change to the page background.
Consultar também
- Extension:NewPageCSS
- Extensão: TemplateStyles - uma extensão similar que limpa CSS guarda-o em páginas separadas.
| This extension is included in the following wiki farms/hosts and/or packages: |
- Stable extensions/pt
- Parser function extensions/pt
- ParserFirstCallInit extensions/pt
- RawPageViewBeforeOutput extensions/pt
- GPL licensed extensions/pt
- Extensions in Wikimedia version control/pt
- All extensions/pt
- Extensions requiring Composer with git/pt
- Extensions included in Miraheze/pt
- Extensions included in MyWikis/pt
- Extensions included in ProWiki/pt
- Extensions included in Telepedia/pt
- User interface extensions/pt
- Script embedding extensions/pt
- CSS/pt
