foreword
For front-end developers, resource packaging is an indispensable process in the daily process; at present grunt
, gulp
we use webpack
these 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:
use
compile css
release css
optional parameter
-f
Compile all sass files in the directory-w
Monitorsass
directories and compile on the fly ifsass
files change-m
Compile mode, defaultexpanded
, recommended for production environmentcompressed
(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);