Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #229 from fourkitchens/pl-attach-library
Browse files Browse the repository at this point in the history
Added attach_library Twig function in PL
  • Loading branch information
Evan Willhite committed May 11, 2018
2 parents 0259f75 + 7f1ebfc commit 1cebd07
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/_patterns/01-atoms/04-images/icons/_icon.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{% set icon_base_class = icon_base_class|default('icon') %}
{% set icon_url = '' %}

{# Drupal #}
{# If using Drupal, you will want to uncomment the section below and set the path to match your theme. #}
{# {% if attributes or theme_hook_original %}
{% set icon_url = '/themes/custom/YOURTHEME/dist/img/sprite/' %}
{{ attach_library('emulsify/sprite') }}
Expand Down
3 changes: 2 additions & 1 deletion components/_patterns/01-atoms/04-images/icons/icons.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
title: Icons
---

### How to use icons

We are using a gulp SVG sprite generator (details [here](https://una.im/svg-icons)), which automatically creates the SVG in `/images/icons/sprite/sprite.svg`. Simply run `gulp icons` to add to the sprite.

**Usage**

The SVG component is found here: `/components/_patterns/01-atoms/04-images/icons/_icon.twig`. See available variables in that file. Examples of usage below:
The SVG component is found here: `/components/_patterns/01-atoms/04-images/icons/_icon.twig`. See available variables in that file as well as instructions for Drupal. Examples of usage below:

Simple: (no BEM renaming)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
/**
* @file
* Add "attach_library" function for Pattern Lab.
*/

$function = new Twig_SimpleFunction('attach_library', function ($string) {
return $string;
});

0 comments on commit 1cebd07

Please sign in to comment.