Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

twg_'s avatar
Level 6

Convert Gulp task to Webpack

Hi,

I'm not sure if this is possible or not but I was wondering if there is a way to go through a file(s) replace a prefix in SCSS & JS. I've seen it done in UIKit v2 but it's in gulp.

0 likes
2 replies
Sinnbeck's avatar

I am unsure what you are asking. Do you have a gulp config you wish to setup in webpack so it does the same?

If so you should post the config. Maybe someone can give you some pointers.

If not, then please give an example of what you are trying to accomplish

twg_'s avatar
Level 6

Yeah I'm wanting to recreate this gulp task in webpack.

gulp.task('prefix', function(done) {
    var prefix = gutil.env.p || gutil.env.prefix || false;

    if(!prefix) {
        return done();
    }

    gutil.log("Replacing prefix 'uk' with '"+prefix+"'");

    gulp.src(['./dist/**/*.css', './dist/**/*.less', './dist/**/*.scss', './dist/**/*.js'])
        .pipe(replace(/(uk-([a-z\d\-]+))/g, prefix+'-'))
        .pipe(replace(/data-uk-/g, 'data-'+prefix+'-'))
        .pipe(replace(/UIkit2/g, 'UIkit2'+prefix))
        .pipe(gulp.dest('./dist'))
        .on('end', done);
});

Please or to participate in this conversation.