Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Gulp Basics Improving your Gulp Task Pipelines Where to next?

Kathy Szczesny
Kathy Szczesny
2,329 Points

'fonts' task doesn't create /dist/fonts folder after 'clean' task run?

I followed all the install instructions and have everything in place, but when I try to run the task: gulp fonts, it starts and finishes but the /dist/fonts/ directory isn't created.

following this because I get the same.

[11:48:44] Starting 'clean'... [11:48:44] Finished 'clean' after 45 ms [11:48:44] Starting 'default'... [11:48:44] Starting 'scripts'... [11:48:44] Starting 'styles'... [11:48:45] Starting 'markups'... [11:48:45] Starting 'fonts'... [11:48:45] 'fonts' errored after 46 ms [11:48:45] Error: Bower components directory does not exist at...

Same issue for me. Halp.

ETA: I did ensure that Bower was installed, as this was also an issue in the git-repo. It appears that the bower directory is now missing from the repo. Am I seeing this correctly?

4 Answers

The gulp fonts task is not getting a proper source, so it is returning no output, so it doesn't create the directories.

It's a problem with the module "main-bower-files" that I couldn't figure out without digging way deeper into bower and the associated tools. Something about how they are used changed after this lesson was written.

But you can bypass the problem by going to the gulp fonts task in build.js and replacing

'$.mainBowerFiles()'

with

'bower_components/**/*'

That glob will find all the files in the bower_components subfolders and pass them to be filtered by the next command.

Huston Hedinger
STAFF
Huston Hedinger
Treehouse Guest Teacher

Hey Guys - the fonts task is not "failing", there are probably no fonts installed in the bower components.

  // Only applies for fonts from bower dependencies
  // Custom fonts are handled by the "other" task
  gulp.task('fonts', function () {
    return gulp.src($.mainBowerFiles())
      .pipe($.filter('**/*.{eot,svg,ttf,woff,woff2}'))
      .pipe($.flatten())
      .pipe(gulp.dest(options.dist + '/fonts/'));
  });

The gulp.src method is looking in the bower_components folder ($.mainBowerFiles()) for any fonts $.filter('**/*.{eot,svg,ttf,woff,woff2}').

Now if you are talking about the Bootstrap glyphicons not showing up, that is an issue with how the boostrap-sass bower component is configured and how gulp is running. This is a problem a lot of folks run into when they are using a task runner with Bootstrap.

There will be two different solutions for fixing the issue whether you are using gulp serve to serve the files in development or gulp to build the files for production.

Keep in mind that this is a super advanced example. Don't feel like you need to be able to fix everything right now if this is your first exposure to gulp (or JavaScript)! ;-)

Huston, I am sorry if I am being dense, but I don't think we are talking about the same thing. For myself, I am just following along with your steps and running the gulp font task, but things are not matching up. Please review the original post. The problem is that the dist folder does not get created. The error message I get (like the one Cheryl posted above) says that the font task is looking for the Bower directory and not finding it, and then there are several more lines of messages.

The video shows the clone of the repo but the list of items is not the same as what is currently in the repo on git. The bower_components directory and the dist directory are shown in the video beginning at 0:31. Are they supposed to be created at some point? Are we missing a step?

Huston Hedinger
STAFF
Huston Hedinger
Treehouse Guest Teacher

Sally, this should probably be a different forum topic (different error). Can you post under a new forum topic?

Done