5 ms·
Ask HN: Is asset building as a service (ABaaS) a good idea?
I have this idea which I think is a killer, revolutionary, amazing idea but not sure if I'm right or just insane. Create a service that accepts a list of Javascript dependencies (from either NPM or GitHub), minifies them, combines them, and returns them to you in one file, in a RESTful API. Like this:
POST https://assetbuildservice.com/assets
assets[]=github.com/foobar/package1&assets[]=github.com/bazquz/package2
302 Redirect
Location: https://assetbuildservice.com/assets/da39a3ee5e6b4b0d325
GET https://assetbuildservice.com/assets/da39a3ee5e6b4b0d325?prod=1
200 OK
/* Ref: https://assetbuildservice.com/assets/da39a3ee5e6b4b0d325
* AssetBuildService.com built your assets! */
(function(a,b,c){d,e,f=0,0,1,...
The ABaaS would know how to make RequireJS play nice with AMD/CommonJS in one project, and other JS projects that don't use a requiring system. But that's it. It doesn't know how to transpile other languages to JS or do anything fancy with dependency trees -- it just creates a flat file that combines every dependency. It's too dumb to figure out what order they go in too, so you'd have to experiment with that in your API calls. It could be an open source library that's also hosted on a community-funded server.
What do you think? Useful or useless?
- riebschlager 11y agoClever idea! My current workflow for doing this same job is just using Bower to manage the dependencies and a Gulp script to concat them. I'd be a little worried about moving all my dependencies "to the cloud" like this. But loads of people use sites like CDNJS, so I can definitely see it being used. I'm not sure I'd want to be paying the hosting bills if it takes off though :)
- tboyd47 11y agoThanks, that's encouraging! All I want a service for is building assets, not hosting them, so there are easy ways to secure it from that angle: making the build URLs expire after 60 seconds, making users authenticate to access them, etc.