The unix philosophy Do one thing and do it well guides the node ecosystem, it is not surprising that web developers are starting to adopt this approach as well. One of the downsides to the unix philosophy is the amount of dependencies you need in order to create a complex application.
In contrast to the battle harden npm that rule the land of commonjs packages, managing web dependencies is less straightforward. The current heavyweight champion for web dependencies package manager is bower, it has many problems, but aligning with the unix philosophy we aim to address only one.
Our Goal is to managed web dependencies without the use of the
bower.json, personally I prefer no to use configuration files, more specifically I think that web dependencies should be resolve in one of the stages of the build process, giving us the ability to manage the project web dependencies according to the run environment - local/test/dev/prod etc’.
As mentioned earlier we follow the unix philosophy which emphasise strings stream inputs and outputs, meaning our program inputs and outputs strings stream, this also fits well to the gulp ecosystem which give us access to large number of plugins we for future use. Following the KISS principle we choose to pipe the stream as is, without any modification (at least in this early stage).
The obvious problem we needed to solve was where to place the bower meta data needed for resolving the dependencies, basically where to place the package names. There were two solutions for that, assigning it as a configuration or embedding it within the input streams as parameters. Choosing the configuration solution would be like placing bandaid on the problem we were trying to solve, most likely it would lead to generating
Our current solution is simple:
managed-bowerattribute to the script tag.
name="my-package"attribute to the script tag,
my-packageis the bower package name.
- Stream the HTML files to managed-bower, directly or with gulp, consult the readme for usage examples.
No particular order:
- Use other tags,
<link>the first one.
- Package versions.
- Namespaces (for archiving modularity).
- Cleaning HTML file.
- Inlining the required files (this would most likely would be in a different project).
- Add configuration to return the required files.
- Well, whatever you suggest.