[Coldbox 6.5.2][Elixir 3] Is it Possible to Mix() an Entire Directory of JS Files?

Processing individual .js files in Elixir using mix.js() is straightforward and can be done like this:

mix
	.js( 
	    "app.js",
	    {
	        name: "app",
	        entryDirectory: "resources/js/",
	        outputDirectory: outputFolder + "js/"
	    } 
	)
	.js( 
	    "main-index.js",
	    {
	        name: "main-index",
	        entryDirectory: "resources/js/",
	        outputDirectory: outputFolder + "js/"
	    } 
	)

Therefore, is it possible to process all .js files in a particular directory? I couldn’t find a reference to anything in the docs other than just copying individual files/folders.

I was hoping I could do some type of wildcard processing, but it does not look like this feature is supported (yet):

mix
  .js( 
     "*.js",
        {
          entryDirectory: "resources/js/",
          outputDirectory: outputFolder + "js/"
        } 
  )

Is there another or better way to batch process a series of .js files in Elixir or do they need to be manually specified in webpack.config?

It accepts an array of files, so you could use something like glob to get that array of files:

const glob = require("glob");
mix.js( glob.sync("resources/assets/*.js") );
1 Like

Thank you, this is my first experience using a glob.