I am using Laravel 5. During gulp task, the processed SASS files and other CSS files copied from resource folder are stored in public/css. Then all the files in the public/css are merged together to a single file as "all.css". So the files that were created needs to be deleted.
How can I do this?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With