Skip to content
Snippets Groups Projects

Resolve #3304650 "Theme stylesheet documentation"

8 unresolved threads

Closes #3304650

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
18 18 * - name: The machine name of the theme.
19 19 * - status: 1 for installed, 0 for uninstalled themes.
20 20 * - info: The contents of the .info.yml file.
21 * - stylesheets: A two dimensional array, using the first key for the
22 * media attribute (e.g. 'all'), the second for the name of the file
23 * (e.g. style.css). The value is a complete filepath (e.g.
24 * themes/olivero/style.css). Not set if no stylesheets are defined in the
25 * .info.yml file.
26 * - scripts: An associative array of JavaScripts, using the filename as key
27 * and the complete filepath as value. Not set if no scripts are defined
28 * in the .info.yml file.
21 * - libraries: An associative array of libraries defined by the theme,
  • We should not be referencing what something used to be unless it is a deprecation. The docs should describe how something currently works without the context of how it worked previously.

    Also, the description itself is not accurate. Libraries are defined by the theme in the libraries.yml file. This setting does something more specific. I'm sure @yash.rode can figure it out.

  • Yash Rode changed this line in version 2 of the diff

    changed this line in version 2 of the diff

  • I tried putting a breakpoint in one of the theme and used that, extension object to write this doc. I hope that's a good start.

  • Please register or sign in to reply
  • Ben Mullins
    Ben Mullins @bnjmnm started a thread on the diff
  • 43 43 * See node.info.yml for an example of a module .info.yml file.
    44 44 *
    45 45 * Information stored in a theme .info.yml file:
    46 * - screenshot: Path to screenshot relative to the theme's .info.yml file.
    47 * - engine: Theme engine; typically twig.
    46 * - name: The name of the theme.
    47 * - type: The type of the theme; typically 'theme'.
    • This is not correct. I'd like @yash.rode to first attempt figuring this out before having a reviewer provide a correction. Grepping through Drupal's code should provide enough context clues to figure out what needs to be changed here.

    • I have tried changing some of the properties after looking at the existing *.info.yml files.

    • Please register or sign in to reply
  • 33 33 * This ensures proper cascading of styles so themes can easily override
    34 34 * module styles through CSS selectors.
    35 35 *
    36 * Themes may replace module-defined CSS files by adding a stylesheet with the
    37 * same filename. For example, themes/olivero/system-menus.css would replace
    38 * modules/system/system-menus.css. This allows themes to override complete
    39 * CSS files, rather than specific selectors, when necessary.
    36 * Modules and themes must declare their CSS and JS assets in library
  • 33 33 * This ensures proper cascading of styles so themes can easily override
    34 34 * module styles through CSS selectors.
    35 35 *
    36 * Themes may replace module-defined CSS files by adding a stylesheet with the
    37 * same filename. For example, themes/olivero/system-menus.css would replace
    38 * modules/system/system-menus.css. This allows themes to override complete
    39 * CSS files, rather than specific selectors, when necessary.
    36 * Modules and themes must declare their CSS and JS assets in library
    37 * definitions. Themes can override module-defined libraries by using the
    38 * `libraries-override` feature in their theme's .info.yml file. This allows
    39 * themes to override entire CSS or JS files, rather than specific selectors
    40 * or functions, when necessary.
    41 *
    42 * For example, to override the 'system' module's system-menus library, you
  • 45 * Example:
    46 * In your theme's mytheme.info.yml file:
    47 *
    48 * name: 'My Theme'
    49 * type: theme
    50 * base theme: olivero
    51 * description: 'A custom theme'
    52 * package: Custom
    53 * version: '1.0'
    54 * core_version_requirement: ^8 || ^9
    55 *
    56 * libraries-override:
    57 * system/misc:
    58 * css:
    59 * theme:
    60 * css/system-menus.css: css/overridden-system-menus.css
  • 47 * - engine: Theme engine; typically twig.
    46 * - name: The name of the theme.
    47 * - type: The type of the theme; typically 'theme'.
    48 * - description: A description of the theme.
    49 * - package: The package name to group themes in the admin UI.
    50 * - version: The version of the theme.
    51 * - core_version_requirement: The required core version.
    52 * - screenshot: Path to a screenshot relative to the theme's .info.yml file.
    48 53 * - base theme: Name of a base theme, if applicable.
    49 * - regions: Listed regions.
    50 * - features: Features available.
    51 * - stylesheets: Theme stylesheets.
    52 * - scripts: Theme scripts.
    54 * - engine: Theme engine; typically 'twig'.
    55 * - regions: Defined regions for the theme.
    56 * - libraries: Libraries defined by the theme.
  • 18 18 * - name: The machine name of the theme.
    19 19 * - status: 1 for installed, 0 for uninstalled themes.
    20 20 * - info: The contents of the .info.yml file.
    21 * - stylesheets: A two dimensional array, using the first key for the
    22 * media attribute (e.g. 'all'), the second for the name of the file
    23 * (e.g. style.css). The value is a complete filepath (e.g.
    24 * themes/olivero/style.css). Not set if no stylesheets are defined in the
    25 * .info.yml file.
    26 * - scripts: An associative array of JavaScripts, using the filename as key
    27 * and the complete filepath as value. Not set if no scripts are defined
    28 * in the .info.yml file.
    21 * - libraries: An associative array of libraries defined by the theme,
    22 * replacing the older 'stylesheets' and 'scripts' properties.
    29 23 * - prefix: The base theme engine prefix.
    30 24 * - engine: The machine name of the theme engine.
    31 25 * - base_theme: If this is a sub-theme, the machine name of the base theme
  • Yash Rode added 2 commits

    added 2 commits

    Compare with previous version

  • Yash Rode added 7 commits

    added 7 commits

    Compare with previous version

  • Yash Rode added 1 commit

    added 1 commit

    Compare with previous version

  • Yash Rode added 10 commits

    added 10 commits

    Compare with previous version

  • catch @catch started a thread on the diff
  • 33 33 * This ensures proper cascading of styles so themes can easily override
    34 34 * module styles through CSS selectors.
    35 35 *
    36 * Themes may replace module-defined CSS files by adding a stylesheet with the
    37 * same filename. For example, themes/olivero/system-menus.css would replace
    38 * modules/system/system-menus.css. This allows themes to override complete
    39 * CSS files, rather than specific selectors, when necessary.
    36 * Modules and themes must declare their CSS and JS assets in library
    37 * definitions. Themes can override module-defined libraries by using the
    • This documentation looks OK but I don't think AssertResolverInterface is the right place for it - it should go wherever theme .info.yml files are documented, which I can't find..

    • Please register or sign in to reply
    Please register or sign in to reply
    Loading