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 #268 from shaal/emulsify.php
Browse files Browse the repository at this point in the history
Improving theme cloning process in order to minimize manual updates
  • Loading branch information
ccjjmartin committed Jul 6, 2018
2 parents 24b4aba + 06d72cb commit e00919c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions components/_patterns/01-atoms/04-images/icons/_icon.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
*/
#}
{% set icon_base_class = icon_base_class|default('icon') %}
{# For Drupal: Update this path to match your theme directory structure #}
{# For Pattern Lab: The icon_url is defined in _data/paths.json. No action is required #}
{% set icon_url = icon_url|default('/themes/custom/YOURTHEME/dist/img/sprite/') %}
{# Update `emulsify` here to your theme's machine name #}
{# For Drupal: The icon_url is defined in the following line. No action is required #}
{% set icon_url = icon_url|default('/themes/custom/emulsify/dist/img/sprite/') %}
{{ attach_library('emulsify/sprite') }}

<svg {{ bem(icon_base_class, (icon_modifiers), icon_blockname, (icon_js_class)) }}>
Expand Down
13 changes: 6 additions & 7 deletions emulsify.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ function _emulsify_get_files_to_copy() {
'components/_macros',
'components/_meta',
'components/_twig-components',
'components/css',
'components/images',
'components/_patterns/style.scss',
'components/_patterns/00-base/global/01-colors',
Expand Down Expand Up @@ -550,7 +549,7 @@ function _emulsify_get_files_to_rename() {
* @return boolean
* A boolean representing the success or failure of the function.
*/
function _emulsify_alter_files($theme_path, array $files_to_alter = array(), array $alterations = array(), $absolute = FALSE) {
function _emulsify_alter_files($theme_path, array $files_to_alter = array(), array $alterations = array(), $absolute = FALSE, int $depth = 0) {
if (empty($files_to_alter) || empty($alterations)) {
return TRUE;
}
Expand All @@ -568,11 +567,11 @@ function _emulsify_alter_files($theme_path, array $files_to_alter = array(), arr
$files = scandir($file_path);
$files = array_splice($files, 2);
foreach ($files as $file) {
$processed_files[] = $file_path . $file;
}
$alter_status = _emulsify_alter_files($theme_path, $processed_files, $alterations, TRUE);
if ($alter_status === FALSE) {
return FALSE;
$processed_file = [$file_path . DIRECTORY_SEPARATOR . $file];
$alter_status = _emulsify_alter_files($theme_path, $processed_file, $alterations, TRUE, $depth + 1);
if ($alter_status === FALSE) {
return FALSE;
}
}
}
elseif ($file_type === 'file') {
Expand Down

0 comments on commit e00919c

Please sign in to comment.