6 ms·
Show HN: JohnnyDepp – A tiny dependency manager for modern browsers in 862 bytes
- andres 8y agoHi Everyone - author here. I just wanted to give you some background on the project. JohnnyDepp came out of a feature request I got on another project called LoadJS (https://github.com/muicss/loadjs https://github.com/muicss/loadjs) which is an async loading library. The request was for a higher-level dependency manager that: 1. lazy-loads files 2. handles JS/CSS/images 3. handles nested dependencies 4. makes it easy to manage dependencies among team members 5. is extremely lightweight I realize that many teams use RequireJS to manage dependencies but I saw an opportunity to make a library that could accomplish many of the same things but with a much smaller footprint and a simpler API. I hope you'll give it a try and let me know what you think!
- TekMol 8y agoHave you looked into <script type=module>? When you use that, you have dependency management supported by the browser natively. In that light, are custom dependency loaders still needed?
- andres 8y agoThanks for the recommendation! I wasn't aware of the modules feature or that it was already supported in Chrome/Safari/Firefox/Edge. I'll take a closer look at modules but if you're only targeting edge browsers then maybe you can do dependency management purely natively.
- jaequery 8y agoI remember using this 8 years ago. Lazy loading is awesome and way to go!
- MaxGabriel 8y agoThis is without doubt the worst dependency manager I have ever heard of.
- ettoretorti 8y agoBut you have heard of it.
- hnbroseph 8y agowhat qualities do you feel make it so?
- MaxGabriel 8y agoIt’s a quote from Pirates of the Caribbean, about the character Johnny Depp played: https://youtu.be/wv9PWo-KLc0 https://youtu.be/wv9PWo-KLc0 https://youtu.be/CAt5JB96Cdk https://youtu.be/CAt5JB96Cdk
- juststeve 8y agoCringe level: 100%
- LinuxBender 8y agoIs he cool with using his name and likeness?
- andres 8y agoYes
- UweSchmidt 8y agoOut of curiosity, how did you go about obtaining permission?
- gamblor956 8y agoCan you prove this? People could easily run into legal issues if they want to use this and it turns out he didn't grant the use of his name.
- shanghaiaway 8y agoHow's Johnny really managing his dependencies?
- jarcane 8y agoGiven his behavior over the years: not well.
- o_____________o 8y agoMaybe you should name this JohnnyDep so it's more an allusion and less the actual person's name? Dep makes more sense anyways, as dependency has one p.
- dboreham 8y agoExtending the subtlety vector a little more: "Johnny"
- quickthrower2 8y agoor "Jack"
- dboreham 8y agoThe config would be what you might call "guidelines".
- gojomo 8y agoOr perhaps `JonnyDep` or `JonnyDeps`. A whimsical allusion to someone else can be playful and respectful. But to appropriate someone else's full exact name for another purpose is kind of rude – especially if that person makes their living from their public image/name.
- jaequery 8y agonice name!
- sdx23 8y agoI really don't understand modern web development. If people would build websites without shit, they wouldn't need stuff like this.
- Raphmedia 8y agoThat's not for building simple static websites or simple blogs. That's for when you build a web application. Think Slack client, gmail, Jira, etc.
- quickthrower2 8y agoThe web as a "document only" medium is long gone. However where I would slightly agree with you is new sites that could have a simple interface loading tonnes of JS. But for business apps delivered over the web, yes we need tooling to tame JS.
- spankalee 8y agoPlease no. Write standard modules. Serve standard modules to modern browsers, optionally bundling to modules for production. Bundle to non-modules for legacy browsers. Then we can all eventually move forward from this mess of non-standard module formats and loaders.
- asdkhadsj 8y agoWhat are "standard modules" for modern browser? I don't typically frontend dev these days, so I'm likely a bit out of the loop. The way I typically thought of dependencies with browsers was to bundle them all together. Is there some new solution to this problem?
- sephware 8y agoThey’re still mainly bundlers for now, such as webpack. But browsers are slowly adopting first class modules which has already been solidified by the spec afaik.
- mhd 8y agoProbably using the ES2015 import syntax[1], which allows you to dynamically load modules. I have my doubts whether your average medium+ sized JS app will be that dynamically, so you'll probably end up slurping a whole lot o' module at startup. And without tree-shaking, more stuff to download and digest. [1]https://caniuse.com/#feat=es6-module-dynamic-import https://caniuse.com/#feat=es6-module-dynamic-import
- spankalee 8y agoYou can bundle modules together so you don't have a ton of downloads, but the basic module graph will at least be loadable. WebPackaging will also help in the future.
- crescentfresh 8y agoOne thing that really sours me in esm is that this is possible (fictional main.js): import Vue from 'vue' import jQuery from 'jquery' global.jQuery = jQuery // to get the next line to work import Bootstrap from 'bootstrap' import 'bootstrap/dist/css/bootstrap.css' Then my head explodes. Why would importing a .css file from my JavaScript ever be a thing supported by any tooling. What is that line trying to communicate? What does it even mean to my current scope? (hint: nothing) import became a giant "do something cool on this line" that maybe the tooling you're using knows how to translate via (say) a webpack loader. For anyone wondering, that line gets translated to the browser dynamically including css on the page.
- Boulth 8y agoCool, reminds me of this [0], it's 850 chars before gzipping. [0]: https://curiosity-driven.org/minimal-loader https://curiosity-driven.org/minimal-loader
- mjg59 8y ago…why would you name this after a domestic abuser?
- superflyguy 8y agoIt's named after a great actor.
- boogah 8y agoWho just so happens to be a domestic abuser, so...
- superflyguy 8y agoSo I read, but that doesn't detract from his acting ability, which is presumably why his name is being used for this project.
- faitswulff 8y agoAgreed, this is an uncomfortable name.
- np_tedious 8y agoDo you take similar issue with the framework Sinatra?
- faitswulff 8y agoSinatra's dead. Depp is a real, living actor and the value of his name directly affects his current net worth. Glorifying him, therefore, is different than doing the same for Sinatra.
- deleted 8y ago[deleted]
- sehugg 8y agoNothing beats my dependency manager, which I'll just call DrGonzo: var exports = {}; function require(modname) { if (modname == 'jquery') return $; else if (modname.startsWith('.')) return exports; else { console.log("Unknown require()", modname); return exports; } } (Of course you've gotta <include> the modules ahead of time -- I actually use this for http://8bitworkshop.com/ http://8bitworkshop.com/)