Coldbox Elixir[3.1.11] Mix a Folder as Separate Files

Is there a way in Coldbox Exlixir to mix all files within a folder as separate files?

Currently, in my multi-page web app, I have to mix individual, page-specific, Javascript files like this:

mix
    // Global SASS/CSS
    .sass( 
        "app.scss",
        {
            name: "app",
            entryDirectory: "resources/sass/",
            outputDirectory: outputFolder + "css/"
        } 
    )
    // Global JS
    .js(
    	"app.js",
    	{
    		name : "app",
            entryDirectory : "resources/js/",
            outputDirectory: outputFolder + "js/"
    	}
    )
    // Page Specific JS
    .js(
        "users-index.js",
        {
            name : "users-index",
            entryDirectory : "resources/js/",
            outputDirectory: outputFolder + "js/"
        }
    )
    .js(
        "users-show.js",
        {
            name : "users-show",
            entryDirectory : "resources/js/",
            outputDirectory: outputFolder + "js/"
        }
    )
    .js(
        "users-form.js",
        {
            name : "users-form",
            entryDirectory : "resources/js/",
            outputDirectory: outputFolder + "js/"
        }
    )
    // Global Vendor
    .js(
    	[
    		"node_modules/jquery/dist/jquery.min.js",
            "node_modules/bootstrap/dist/js/bootstrap.min.js",
            "node_modules/datatables/media/js/jquery.dataTables.min.js"
    	],
    	{
    		name : "vendor",
            entryDirectory : "",
            outputDirectory: outputFolder + "js/"
    	}
    );

In a large app, it will start to get cumbersome to remember to mix every single static JS file in my webpack.config. Is there a shortcut or prefered method to handle mixing an entire folder so that it outputs each file individually?

I’m still a noob at Elixir so please excuse me if I’m missing something obvious or if there’s a particular convention I should be using in multi-page web apps.

1 Like