gulp-alivevn-del-files
v2.0.2
Published
Delete unused files
Downloads
9
Readme
Gulp Alive Outsource Delete files
gulp-alivevn-os-del-files is a Gulp plugin which will find unused files and deletes them. If you are using WP or other CMS, Framework, please CONSIDER when deleteing files.
File name shouldn't contain special characters "!@#$%^&*()"
Installation
npm i gulp-alivevn-del-files --save
Usage
var deleteUnusedFiles = require("gulp-alivevn-del-files");
gulp.task('files_filter', function() {
var unusedFiles = new deleteUnusedFiles({
log: true,
imageFile: true,
jsFile: true,
cssFile: true,
fontFile: false,
uri: "http://"+url,
directory: process.cwd()+'/dist',
});
unusedFiles.crawlLinks();
unusedFiles.on('done', function(allLinks) {
gulp.src([
'dist/*.jpg',
'dist/**/*.jpg',
'dist/*.png',
'dist/**/*.png',
'dist/*.svg',
'dist/**/*.svg',
'dist/*.gif',
'dist/**/*.gif',
'dist/*.bmp',
'dist/**/*.bmp',
'dist/*.css',
'dist/**/*.css',
'dist/*.js',
'dist/**/*.js',
'dist/wp/wp-content/uploads/',
'dist/wp/wp-content/uploads/**/',
'!dist/wp/*',
'!dist/wp/wp-admin/',
'!dist/wp/wp-admin/**/',
'!dist/wp/wp-includes/',
'!dist/wp/wp-includes/**/',
'!dist/wp/wp-content/languages/',
'!dist/wp/wp-content/languages/**/',
'!dist/wp/wp-content/plugins/',
'!dist/wp/wp-content/plugins/**/',
'!dist/wp/wp-content/themes/',
'!dist/wp/wp-content/themes/**/',
'!dist/wp/wp-content/upgrade/',
'!dist/wp/wp-content/upgrade/**/',
])
.pipe(unusedFiles.crawlFiles(allLinks.found))
.on('end', function() {
})
});
})
Options
log
boolean | default: trueLog the output to console
imageFile
boolean | default: trueFind images files
jsFile
boolean | default: falseFind js files ( .js )
cssFile
boolean | default: falseFind css files (.css)
fontFile
boolean | default: falseFind font files ( .eot, .otf, .woff, .woff2, .ttf, .svg )
uri
string | default: "" | requiredSite URI, example: "http://"+url, "http://minto.out.src.com"
directory
string | default: "" | requiredprocess.cwd()+'/dist'
How to use
NPM instal GULP and in terminal, locate to project directory and run "gulp files_filter" command line.
Release History
- 2.0.2 Bug fixes
- 2.0.1 update README.me
- 2.0.0 Whole new release
- 1.0.0 Initial release