c-filter v1.0.3
c-filter
js toolkit is used to clean up unused pictures in web projects
Support request service data to filter
It will not change the original resource, only find the referenced resource and copy it to the imagePath_copy directory.
Install
Globally
npm install c-filter -gLocally
npm install c-filter --save-devUsage
During global installation, you can directly execute the "cft" command in the project to run the program
cftWhen installing in the project, you need to configure scripts and use "npm run cft" to run the program
{
scripts:{
"cft":"cft"
}
}npm run cftIf npm version>=5.2, npx can be used without scripts
npx cftThe image path is a required parameter and it can be passed in on the command line (the path is relative to the project root directory)
cft src/images
cft --path src/imagesYou can also use the configuration file "cft.config.js" to pass parameters, and the file needs to be placed in the project root directory
module.exports = {
path: "src/images"
}Ignore folders that do not need to be checked
Default Ignore: '.vscode', '.git', '.github', 'node_modules', 'build', 'config', 'test', 'types'
module.exports = {
path: "src/images"
exclude: ["data"]
}If the picture is rendered by requesting service data, you can configure the api to request service data for filtering
for request parameters in apiList, please refer to axios
module.exports = {
path: "src/images",
exclude: ["data"],
apiList: [
{
type: 'get',
url:"http://xxx/resource"
}
]
}