c-filter

1.0.3 • Public • Published

c-filter

npm version

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 -g

Locally

npm install c-filter --save-dev

Usage

During global installation, you can directly execute the "cft" command in the project to run the program

cft

When installing in the project, you need to configure scripts and use "npm run cft" to run the program

{
  scripts:{
    "cft":"cft"
  }
}
npm run cft

If npm version>=5.2, npx can be used without scripts

npx cft

The 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/images

You 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"
    }
  ]
}

Package Sidebar

Install

npm i c-filter

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

9.04 kB

Total Files

6

Last publish

Collaborators

  • firyang