Using gulp to duplicate files from a specific directory nestled within a larger folder structure

I'm trying to figure out how to address this issue:

My goal is to transfer all fonts from bower_components to .tmp/assets/fonts. However, the complication arises with some fonts being .svg files. If I were to use the following code in a typical manner:

gulp.task('copyBowerFonts', function(){
 return gulp.src("bower_components/**/*.{ttf,woff,eof,svg}")
            .pipe(gulp.dest(paths.tmpFonts));
});

...this would result in copying both font and image files with .svg extension to the .tmp/assets/fonts directory. Ideally, I'd like a solution where all font files within any folder under 'fonts/' are copied to the specified location.

To achieve this, I plan to utilize gulp-flatten to copy files without maintaining their original folder structure.

So, my question is: is there an alternate method or how can we modify the approach to accomplish this?:

gulp.src("bower_components/**/fonts/*.{ttf,woff,eof,svg}"

I believe the solution may be straightforward, yet I haven't been able to find it thus far.

Thank you for your assistance! :)

Answer №1

Your pattern should be effective in your situation.

Remember that Gulp utilizes the glob module:

  • * Represents zero or more characters within a single path segment
  • ** When a "globstar" stands alone in a path segment, it matches any number of directories and subdirectories while looking for matches. It does not traverse symlinked directories.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

A guide on choosing a custom button color and automatically reverting to its original color when another button is clicked

I have a collection of 24 buttons, all in a dark grey (#333333) shade. Whenever I click on one of the buttons, it changes to a vibrant blue color (#0099ff), which is functioning correctly. However, when I proceed to click on another button, the previous ...

Tips for embedding a PHP function within JavaScript code

I am working on enhancing an online application with a translation feature. The application comprises of a frontend coded in HTML and JS, and a backend developed using PHP that is linked to a database. Communication between the frontend and backend occurs ...

Upgrade your function to utilize Firebase V9 with Next.js framework

I recently updated my project to use version 9 of firebase, and since then, I've been encountering some code errors that I'm struggling to resolve. The previous function had the following structure, but now I need to update it to work with the n ...

Creating a Javascript countdown timer that does not involve displaying the

I stumbled upon this code on a website, but there's one tweak I'd like to make. Unfortunately, I can't seem to figure it out myself, so I'm reaching out for some help. What I want to achieve is removing the year from the date so that th ...

What is the best way to incorporate "thread.sleep" in an Angular 7 app within a non-async method like ngOnInit()?

Despite the numerous questions and solutions available on Stack Overflow, none of them seem to work when called from a component's init function that is not asynchronous. Here's an example: private delay(ms: number) { return new Promise( ...

What is the best way to combine two nearly identical arrays/objects using underscorejs or a similar library?

In the realm of lists, there exists an old list and a new one. The mission at hand is to combine both, even in the presence of newly added key-value pairs. var oldList = [{ id: 1, name: 'Michael', sex: 'male', goodlooking: 1 }, ...

The Firefox extension is unable to activate any click events

Currently, I am developing a Firefox add-on with the goal of automatically filling in login form fields and submitting the login. For each website, I have access to various identifiers such as ids, classes or xpath, depending on what is provided by the web ...

Leverage PHP to dynamically populate a chart.js visualization with information sourced from an SQLite Database

I'm attempting to use chart.js to display data from an SQLite database using PHP, but I've been running into issues. Despite following multiple online tutorials, my graph remains empty or disappears altogether. This is my first time working with ...

Customizing Material UI Themes

Is there a way to customize the MuiTheme overrides for a specific named element like this? .MuiStepLabel-label.MuiStepLabel-active { color: rgba(0, 0, 0, 0.87); font-weight: 500; I've attempted modifying various classes such as MuiStepLabelLa ...

Initiate an "execute.document" command directly from the address bar

While reviewing my old website, I stumbled upon this snippet: <input type="image" id="QuickPass" name="QuickPass" src="/images/QuickPass.gif" alt="Quick Pass" onclick="document.pressed=this.value" value="QuickPass" /> nestled within this form: & ...

Form a collection of X amount of words using a string in JavaScript

Hello amazing Stack community, I am currently striving to create a straightforward JavaScript function that can accurately count the total number of words from a given string value. Furthermore, I aim to store a specific number, X, of words into an array ...

Is it possible to manipulate content using jQuery?

I need help figuring out how to update the content within a span tag when a user clicks on a button. The specific span tag I am trying to target has a class called fa_button_id_counter and an id that corresponds to the post id. Despite my efforts, I haven& ...

Error message: Unable to access properties of null when calling 'registerPlugin' in @devexpress/dx-react-grid-material-ui

I have developed a CustomGrid component that is based on the DevExpress Grid component. So far, it has been working smoothly. Here's how the implementation looks like in App.tsx: import Paper from "@mui/material/Paper"; import { Table, TableHeaderRow ...

Exploring Nodejs and delving into fundamental queries

As I delved into the world of Nodejs, I quickly realized that my knowledge was limited to just being a user. Transitioning to creating my own server posed challenges that were not easily resolved by online tutorials. This led me here seeking guidance to tr ...

Having trouble with NextJS not updating state upon button click?

I am encountering a problem with my NextJS application. I am attempting to show a loading spinner on a button when it is used for user login. I have tried setting the `loading` state to true before calling the login function and then reverting it to fals ...

What is the best way to send and configure GET information when the characters in a URI surpass 5,000?

Currently, I am utilizing a Laravel blade template. However, I encountered an error in my code when the size of the textarea item is quite large. I'm in search of a solution to resolve this issue. Hey everyone! Can you guide me on how to successfull ...

Title of the most recently created file on GitHub

Being new to web designing and javascript, I am seeking help in understanding how to display the latest PDF file in my small website hosted on GitHub. Despite successfully displaying a PDF file, I encountered difficulties when attempting to showcase the mo ...

Inheriting properties from parent npm package.json files

Is there a feature in npm similar to Maven's parent pom concept? The aim is to establish a shared foundational configuration for scripts, dependencies, and devDependencies. This would not be template-based like yeoman, but instead rooted in a parent v ...

The React-loadable alert indicated a discrepancy in the text content

Utilizing react-loadable for dynamic JS module loading is part of my process. With server-side rendering already set up and functioning correctly for react-loadable, I am encountering an issue on the client side. Upon page load, a warning message appears i ...

When configuring lint-staged, a file is created that includes a unique identifier with details on the packages that have been

When starting a new Vue project, I use npm init vue@latest and select all options (including Eslint with Prettier). For this setup, I am on Windows 11 with node v17.4 and npm v8.4. After creating the project via PowerShell, I switch to Visual Studio Code ...