Front-end packaging tool - build release introduction

foreword

For front-end developers, resource packaging is an indispensable process in the daily process; at present grunt, gulpwe use webpackthese three tools most of the time to complete this work; but there is a feature that we do not create a project to correspond to It is quite cumbersome to write the configuration to complete the packaging task, and the various configurations are quite a headache. Based on this reason, I have developed a command-line packaging tool - build release; now I put the user guide, welcome all front-end fans to exchange and correct!

Install

This tool is strongly dependent Compass, so please make sure that your computer has been successfully installed before installationCompass

npm install build-release -g

Default project packaging and destructuring

Because this tool has no rigid requirements for configuration files, there will be certain regulations on the file directory (of course, you can do it according to your own needs, and the detailed configuration will be added later in this article), as shown in the figure:
image

use

compile css

release css

optional parameter

  • -fCompile all sass files in the directory
  • -wMonitor sassdirectories and compile on the fly if sassfiles change
  • -mCompile mode, default expanded, recommended for production environment compressed(compressed mode)

Compress JavaScript

release js

optional parameter

  • increment only incrementally packs modified files

Compress picture

release image

Pack all resources

release all

configure

Of course, this tool also accepts custom configuration files, which are placed in the directory where the task is to be performed, named release.json, the following is an example of a configuration:

{
  "compass" : {
    "zip" : false
  },
  "uglify": {
    "cwd" : "E:\\ljl\\project\\public",
    "out" : "E:\\ljl\\project\\release",
    "concat": {
      "name": "core/main.min",
      "specify": [
        {
          "core/base.min": ["about.js"]
        }
      ]
    },
    "zip" : {
      "target" : "js.zip"
    }
  }
}

Epilogue

The tool is introduced. If you are not satisfied, please detour. If you need to communicate, please contact me (QQ: 625846782);

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326491373&siteId=291194637