meteor-bootstrap
meteor-bootstrap copied to clipboard
Merging support for multiple config files
I really like this package and I would love to use it as a dependency in one of my packages. I was testing if multiple config files are supported, and yes, they are, but in a way that is not too helpful.
To give awesome support for other packages it would be great if the multiple configuration files would be merged, so that a 3rd party package could set a required bootstrap component to true
while the user is still able to define a custom configuration in her/his application.
So let's say the user installs package A, which ships A.bootstrap.json and requires the forms
component.
{"modules": {
"forms": true
}}
Additionally there is package B which ships B.bootstrap.json and requires the tables
component.
{"modules": {
"tables": true
}}
The user then has a custom.bootstrap.json in her/his project, which defines the project specific components required. Most likely there will be forms & tables set to true as well.
Currently this would result in duplicate css rules, forms and tables would be included twice. It would be great if there was a mechanism that would resolve duplicates so that each component is only included once. I tried to implement this through an array outside of the handler method which caches which files have already been processed. But I don't quite get how this handler thingy works as I always end up with empty less files. It appears the handler is run multiple times per file so it's already been processed at the 2nd iteration and the file ends up empty...
(Haven't tested yet if your handler actually works in other packages but from my understanding it should)
OK, so I figured out how to prevent duplicate components. Though it's not working together with other smart packages. Any idea how to make the sourceHandler act on a bootstrap.json file within another package?
I tried to add the file but the resoure handler is not triggered:
Package.onUse(function(api) {
api.versionsFrom('[email protected]');
api.use(["less", "templating"], "client");
api.use(["nemo64:[email protected]_1"], "server"); //that's my fork, PR in #10
api.addFiles('test.bootstrap.json', "server");
});
Tried it with {isAsset: false}
and {isAsset: true}
, doesn't matter. Any ideas?
If we can get this working, this package could be THE bootstrap package used by all other packages.
The source handler should create the final bootstrap files, however you have to add them too because the current solution is kind of a hack. Also, you need to add the package for the client, as it only adds files there. The package has not a single line of code executed during runtime on the server. The source handler is another thing on it's own.
"If we can get this working, this package could be THE bootstrap package used by all other packages."
I agree.