Reputation: 1009
I'm using gulp and I want to know if it has capabilities for code splitting. Something similar to what is mentioned here in the webpack site . Ive looked online but not seen anything dedicated to that.
Upvotes: 9
Views: 3015
Reputation: 1666
I found this on the internet gulp-split-files, I hope this answers your issue.
As you the author has said in the documentation.
In 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"));
});
This will produce three files:
superMegaBigCss-0.css
superMegaBigCss-1.css
superMegaBigCss-2.css
I don't think this package is very useful, as it split the code where we place the comment /*split*/
.
Personally, I love using webpack so much, now I use it in most of my projects, I think it is like a butcher where it chops down the files and bundles it up in different ways.
Upvotes: 1