Delete intermediary files after elixir merge

孤街醉人 提交于 2019-12-04 13:45:10

For newer versions of laravel this worked for me:

var elixir = require('laravel-elixir');
var del = require('del');

elixir.extend('remove', function(path) {
    new elixir.Task('remove', function() {
        del(path);
    });
});

elixir(function(mix) {
    mix.remove([ 'public/css', 'public/js' ]);
});

Cheers!

It was well explained here , anyway just in case it is a broken link, this is what I do and works perfectly. Basically you have to extend gulp and add a "remove" function which uses "del", your last task is just removing the intermediate files once the versioning is finished.

var gulp = require('gulp');
var elixir = require('laravel-elixir');
var del = require('del');

elixir.extend("remove", function(path) {
    gulp.task("remove", function() {
        del(path);
    });
    return this.queueTask("remove");
});

// Usage
elixir(function(mix) {
    mix.remove([ 'public/css', 'public/js' ]);
});

You will probably need to install some npm pagackes like so:

$ npm install --save-dev del
$ npm install --save-dev wrappy
$ npm install --save-dev brace-expansion
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!