jacerider / neo_icon
An IconMoon-based icon manager.
Installs: 216
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:drupal-module
Requires
- drupal/core: ^10.3 || ^11
- jacerider/neo_config_file: ^1
- jacerider/neo_modal: ^1
- dev-develop
- 1.0.42
- 1.0.41
- 1.0.40
- 1.0.39
- 1.0.38
- 1.0.37
- 1.0.36
- 1.0.35
- 1.0.34
- 1.0.33
- 1.0.32
- 1.0.31
- 1.0.30
- 1.0.29
- 1.0.28
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2025-07-01 18:47:19 UTC
README
- Introduction
- Requirements
- Installation
- Usage within PHP
- Usage within SCSS
- Icon Definitions
INTRODUCTION
Allow Icomoon icon packages to be utilized within Drupal.
REQUIREMENTS
This module requires no modules outside of Drupal core.
INSTALLATION
Install as you would normally install a contributed Drupal module. Visit https://www.drupal.org/node/1897420 for further information.
USAGE WITHIN SCSS
A PHP trait has been provided that can be a dropin replacement for the Drupal core StringTranslationTrait.
use Drupal\neo_icon\IconTrait; // Dynamic icon using icon repository. $this->icon('Angel'); // Specific icon by name using weighted library match. $this->icon('Angel', 'drupal'); // Specific icon by name from specific library (if published). If library does // not exist or is not published, a weighted library match will be used. $this->icon('Angel', 'drupal', 'solid'); // Supplying a prefix will filter the dynamic icon repository lookup to only // those definitions that support that prefix. It allows, for example, an icon // to be scoped to only be available in the admin. $this->icon('Angel', NULL, NULL, ['admin']); // If you want to get an get a dynamic icon regardless of the prefix, you can // pass 'any' as the prefix. $this->icon('Angel', NULL, NULL, ['all']);
USAGE WITHIN SCSS
Global icon sets can be utilized directly within .scss files via a mixin.
@use 'neo-icon'; @include neo-icon.icon('drupal', before); @include neo-icon.icon('drupal', after);
This mixin intentionally uses only the icon name and ignore the library. This allows swapping out different icons libraries without having to rename the icons. It can result in a conflict is two libraries and marked as global when both contain an icon with the same name.
ICON DEFINITIONS
Dynamic icons can be defined via a MODULE_NAME.neo.icon.yml
file.
# A definition that will match any string starting with "drupal". drupal.start: start: icon icon: drupal # A definition that will match any string ending with "drupal". drupal.end: end: icon icon: drupal # A definition that will match any string containing the word "drupal". drupal.word: word: icon icon: drupal # A definition that will match the exact string "drupal". drupal.exact: exact: icon icon: drupal # A weight can be added to the definition to control their lookup order. drupal.weight: exact: icon icon: drupal weight: 10 # A definition with a prefix. Prefix can also be an array of strings. drupal.prefix: start: icon icon: drupal prefix: admin