Problem/Motivation

In bs_base 2.0.x, package.json has "build-icons": "node build-icons.js", and the build script runs build-icons before the CSS build. drush bs-tc copies package.json and .fantasticonrc.js into the new child theme, but not build-icons.js, because that file is missing from the list in BsLibCommands::copyThemeFiles().

As a result, npm run build and drush bs-tb fail in every new child theme with Cannot find module .../build-icons.js. The Sass build then fails on @import "variables/icons", because build-icons.js generates that file. No CSS is written, and the site renders unstyled.

Steps to reproduce

  1. drush bs-tc bs_base mytheme "My theme" "My theme"
  2. In the new theme folder, run npm run build.
  3. The build fails with Cannot find module .../mytheme/build-icons.js, and no css/ folder is written.

Proposed resolution

Add 'build-icons.js', to the $files list in BsLibCommands::copyThemeFiles(), next to .fantasticonrc.js. The file is copied only if it exists in the parent theme, so parent themes without it are not affected.

This is an interim fix. #3628146: Share build-icons.js, the fantasticon config and template, and gulpfile.js code with child themes instead of copying them proposes that child themes use the icon build code and the gulpfile.js code from bs_base instead of copying them. Once that lands, bs-tc needs these changes:

  • Stop copying build-icons.js and .fantasticonrc.js.
  • Copy only fantasticon/icons.json from the fantasticon folder, and no longer fantasticon/scss.hbs.
  • Remove gulpfile.js from the search and replace in BsLibCommands that changes the parent's machine name to the child's. The new gulpfile.js finds bs_base by the name bs_base in gulp-options.yml. For a child theme of bs_base, the replacement would change that name to the child's, and the build would fail.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork bs_lib-3628148

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pivica created an issue. See original summary.

  • pivica committed 1a248f1a on 2.0.x
    fix: #3628148 bs-tc does not copy build-icons.js, so the build of a new...
pivica’s picture

Status: Active » Fixed

Fixed.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.