Hi habrayuzer.
Something about intro
Since I quit my job and still have free time, I’ll tell you a little about building scripts, as well as about my artisanal solution a year ago - redjs builder. The article will probably interest js-developers who are leading large projects that are not convenient to keep in one file.
What is it about?
If you are a js developer and you have written something more in your life than a slider plugin on jquery, then you might have thought: “how would it be convenient if the 1 st file were divided into several”. And I had such an idea more than once, even when I was actively engaged in writing my
js library . And then at one time I filled my side ...
Something about this builders
To begin with, it should be said in which cases a builder is needed.
During my practice I met 4 types of projects:
- Any library
- Blozhiki, personal pages and other vermin
- Multi-page projects with a rich front-end
- Single-page applications
')
If you are writing your library, as a rule, in most cases, its assembly (if it is large enough) falls on your shoulders. In other cases, the preparation of scripts for release is often provided by the server side (but unfortunately not always). The builder makes sense to use in the 2nd and 3rd cases to reduce the number of requests to the server. In the 3rd case, however, scripts are usually not compiled into one, but into several files, because all the code in one file is too bold. Single-page applications with proper architecture, store most of the code in separate modules, and they obviously do not require the use of the js assembly.
Afterwards I will say that in its essence an assembly can be of 2 types:
- pasting the contents of files
- translation of some internal syntax
What builders have I seen?
- Very simple (bat file)
- Universal, phased, but long customizable ( Ant )
- Specialized ( GWT )
- Builders in scripting languages (in php, nodejs)
I must say that as builders all of them did not suit me ... I would prefer something like php but simpler and unobtrusive. I also wanted a boxed solution. And some additional features.
Redjs builder
download hereA very simple program written in C # (
yes it depends on windows, it does not require any additional gestures for 7 ).
With permission, I will list some features and advantages:
- The ability to put on startup (when the system starts immediately in the tray)
- build js file from several, and not just gluing and replacing tokens
- the syntax of tokens is made in the style of comments, which does not distract from the code, does not break the highlighting
- strict and loose inclusion. loosely can be excluded from the assembly tree
- autobuilding when files change
- possibility of building in several places at once
- code minification
All my
js projects are built by him.
To look at the program in action, you can download one of them, for example
ree . In the builder (which also needs to be downloaded and unpacked) you need to specify input - the main file from the source folder (in my projects matches the project name), output - the compiled version will be created in the place of the code.
The syntax of the instructions can be viewed both in the builder and on the website in the
documentation .
I am really pleased that I wrote this builder, although I spent a good deal of time (not knowing C # -un then). At the moment, the program regularly works for me on projects 10, both open and closed.
What is the status now?
In fact, despite its merits, this version (2) is outdated in my eyes in just a couple of weeks of use. It has its flaws in the ideology, as well as a couple of bugs, which, because of my inexperience at the time of writing (in WPF and C #), are now difficult to fix.
At the moment, I already have two versions of the builder with a label 3, which is devoid of many shortcomings supplemented with buns and sweets. In the near future I plan to add.
For any feedback / criticism / suggestions I will be grateful.
Ctrl + B