Giter Site home page Giter Site logo

Comments (6)

oogali avatar oogali commented on July 28, 2024 1

What I'd prefer to do is something along the lines of...

import copyStaticFiles, { filter } from 'esbuild-copy-static-files'

const EXCLUDED_FILES = [...]

function excludeFilter(src, dst) {
  if (EXCLUDED_FILES.find(f => src === f) {
    return false;
  }

  return filter(src, dst)
}
...
  plugins: [
    copyStaticFiles({ filter: excludeFilter })
  ]
}

from esbuild-copy-static-files.

nickjj avatar nickjj commented on July 28, 2024 1

Yep! Feel free to open a PR if you want to arrive at a solution that lets you:

  • Define a custom filter function (current behavior)
  • Augment / extend the existing filter function with a new filter function of your choosing

from esbuild-copy-static-files.

nickjj avatar nickjj commented on July 28, 2024

Hi,

If you were to re-implement the filter function what would it look like?

from esbuild-copy-static-files.

oogali avatar oogali commented on July 28, 2024

Otherwise, to cover my use case, I'd end up duplicating all of your filter() code and the functions it depends on into my external function just to pass it back in to your scope as an argument.

from esbuild-copy-static-files.

ianchanning avatar ianchanning commented on July 28, 2024

Yes - I think this would be an excellent addition - exporting the filter function to be able to re-use it is very useful.

from esbuild-copy-static-files.

ianchanning avatar ianchanning commented on July 28, 2024

Ha, I'm actually looking into re-using the filter function and I've just realised that 90% of this plugin is the filter function and its dependencies.

from esbuild-copy-static-files.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.