asset-builder
asset-builder copied to clipboard
Explain the `main` property better
Issues like this keep cropping up: https://github.com/roots/sage/issues/1398#issuecomment-85735520
I'm confused about the 'main' property as well. It seems that its value doesn't matter at all. I didn't have time to go over all the src files and might be missing something, but something strange seems to be happening here: https://github.com/austinpray/asset-builder/blob/master/lib/buildGlobs.js#L78 dependency.main is an object and not a boolean value. So 'if (dependency.main)' will return true as long as the 'main' property exists, irrespective of its actual value.
It seems the issue is in lib/Manifest.js. The options parameter passed to mainBowerFiles at line 25 are just paths, and not all options can be passed to them. (See which options can be passed to mainBowerFiles at https://www.npmjs.com/package/main-bower-files#options)
If this could be changed to just mainBowerFiles(options), then probably we can pass options in when we initialize asset-builder, like
var manifest = require('asset-builder')('./assets/manifest.json', { includeSelf: true });
includeSelf will help include all main bower dependencies. Of course, you first need to specify your main project dependencies at your bower.json file (Check https://github.com/bower/spec/blob/master/json.md#main) like below
"main": [ "path/to/bower/package", "path/to/bower/package", ]
@austinpray please let me know if you can fix this issue at your earliest! Thanks.