Stumbled upon this gem on the web gulp-split-files, thought it might be helpful for you.
Quoting from the documentation itself.
Incorporate this code snippet into your gulpfile:
const gulp = require("gulp");
const splitFiles = require("gulp-split-files");
gulp.task("split", function () {
return gulp.src("superMegaBigCss.css")
.pipe(splitFiles())
.pipe(gulp.dest("path/to/dest"));
});
Running the above task will result in three different files being generated:
superMegaBigCss-0.css
superMegaBigCss-1.css
superMegaBigCss-2.css
Personally, I find the functionality of this package limited as it only splits the code based on a specific comment /*split*/
.
On a personal note, I have become quite fond of utilizing webpack extensively in my projects, likening it to a skilled butcher that efficiently chops and bundles files in various ways.