...
While the simplest operation of the framework would be to unify resources from the various bundles and serve them, it should also support a pluggable architecture for resource compilation and conversion. In order to assess the requirements for such converters, let's consider the two examples in the drawing below.
Gliffy | ||||||
---|---|---|---|---|---|---|
|
The drawing illustrates compilation of two types of resources - a TypeScript file, and an SCSS (SASS) file. Thinking about the flows above, the following points come to mind:
- Resource converters are called in a chain according to the file type (extension) and a predefined order. It might very well be that two resource converters will handle the same file type.
- While a resource converter is triggered by an addition or change of a single resource, it's operation might involve accessing other files. While this is not directly expressed in the drawing, the Typescript compiler (2) might need to access additional typescript files in dependent modules while compiling.
- While it is often the case that a resource converter will output a single file - such as in (3), there will be cases where the output of a conversion would be multiple files. The SASS compiler (7), when configured to use source maps, will output both the css file (8) and also the css.map source map file (9)
- It should be possible to configure converters so that they operate only under certain conditions. The minifiers in the diagram - (4) and (10) should only be called in the deployed product, but not in development.