Why use a build tool beyond npm/yarn like grunt/gulp? [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I come from a world of make and Unix command pipelines. As I survey the landscape of tools that integrate better with the world of node_modules that I'll use in my build, it seems like there are a half dozen tools out there that have similar functions, and I am trying to understand what factors I should consider before investing effort in learning a new tool (and hopefully not learning every tool out there :))
I think I understand that webpack and npm serve slightly different purposes, and that it might make sense to call webpack from npm but probably not vice versa.
Assuming that I have my dependency management taken care of (npm or yarn install), what should I consider when deciding whether to dive deep into say grunt or gulp vs just chaining together various scripts in package.json and letting node or yarn do the lifting?
I understand this question is a bit subjective and vague but I hope the key points came through:
I want something generic but capable
I want something without non-JS requirements in case there is no compiler present (e.g. make or Go not present in my build env)
Assume I am using node modules but without any binary or other language dependencies like node-sass or pygments. I'll be working on unix of some flavor in case that matters.
I'm hoping you'll describe your CRITERIA as well as advocating for the tool you feel is most capable.
Thanks!

Realistically, you are going to make your life the easiest by using whatever has the most support. Currently this seems to be some combination of npm/yarn scripts, webpack, and gulp in different ratios depending on the specifics of what you are doing. Webpack has many plugins that take on common build tasks and thus greatly expand its role as well.

Related

What is the most sane way to manage dependencies for a AngularJs 1.x webapplication [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
At the moment Im using a bunch of script elements which are referring cdn/local files which is not so great.
I think I would like to declare all required packages using npm/yarn and serve cdn files with self hosted fallback (is this even a good idea?).
Should i go for a webpack/browserify solution or is this overkill for this purpose (because AngularJs is already handling dependency injection by itself)? Im getting somewhat lost in the amount of frameworks/information about this topic.
This is an opinion question, so we can only try to figure out what we would do given our knowledge of your needs. With that grain of salt:
What you are describing sounds like way overkill. Unless your performance needs are huge, manage your dependencies with npm and package them with your releases. If you really need to, use a build tool to minify and package your resources together (like webpack).
There are tons of great JS build tools, and if all of the boilerplate is overwhelming, take a look at something like Yeoman which can help out with that.
In my opinion, a self hosted CDN is probably the worst option possible, because it adds huge support requirements with almost no benefits, because as soon as you stop caring about this project someone else will have to refactor all of your code to new CDNs or local resources.

Should I use or avoid Composer for non-PHP dependencies (like jQuery, CSS tools etc.)? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Question
Is there any official statement from the Composer creators that clearly recommends to use or to avoid Composer for JS/CSS/etc-dependencies too ?
Why I'm asking
Fetching JS/CSS-preprocessors etc. with Composer makes sense, but also seems hacky. Some of the big packages (Symfony etc.) are doing it too, they load jQuery, jQuery UI etc. via Composer, however the download numbers are quite low. But this is a clear "technology"-break, the JS-world has its own dependency management tools. There is (afaik) no official statement on the Composer site.
How do other server-side languages handle this ?
I'm searching for an official statement or the recommendation of somebody with deep knowledge of Composer / dependency management.
Like I said in my comment on your question, this is a pretty subjective question. I don't think you're going to get the kind of answer you're looking for. With that in mind, I think the fact there's a 2 year-old feature request still open for managing front end dependencies is fairly authoritative.
IMHO, it comes down to the right tool for the job. Bower does a good job managing front-end dependencies, while Composer shines managing PHP dependencies. I avoid Composer for managing front-end dependencies.
FWIW, I don't know how "deep" my Composer knowledge is, but I've been using it for quite some time, feel comfortable with it, and have presented on it for php|architect. Not an expert, perhaps, but close enough for government work.

I Just Can't Understand Node.JS, Any Resources and Tutorials Out There To Help Me Out? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I know this question has been asked multiple times on this site in one way or another, but even after everything I've looked at I still can't for the life of me work out Node.JS nor how to efficiently use it as well as knowing what it's good for.
I consider myself an advanced JavaScript developer. I'm not just talking about knowing jQuery or Prototype, but rather actually knowing the underlying language quite well which from my understanding is all you really need to learn Node.JS as it is server-side JavaScript after all.
I develop on a Windows machine, but have just installed Virtualbox and an Ubuntu Server ISO to develop Node.JS applications in it. Where do I begin? I know the language, but what now? I can't seem to understand how applications are written in it.
Another question (if I hadn't already asked a million of them) is should I be using a framework for Node.JS like Geddy or Express or should I learn Node.JS and then consider a framework?
I found Node Beginner to be an excellent starting point.
If your time for this project is limited, you should jump right at a framework. If you want a deeper understanding of the tools you are working with, start with a barebones tutorial (which does not make much use of frameworks such as expressjs, backbone). I've also found Node Beginner to be the best starting point, so go with Michael Stum's advice.
Later when you will start using those frameworks, you will be able to understand better what each line actually does.
Check out the official nodejs community wiki. Also see Useful Node.js Tools, Tutorials And Resources
I really would suggest just looking at the documentation on the nodejs.org site itself...
Overview and video http://nodejs.org/docs/latest/
and the API Manual which is not too long and worth a read....
I would suggest that you first start with the basics, and the later go with frameworks and modules of which this should be you starting point

Is there a free/open-source JavaScript-to-JavaScript compacting compiler (like Google's)? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
If you look at the source of Google pages with JavaScript, you'll find that the JavaScript is clearly not readable -- or maintainable. For example, all variables and functions are one-letter named (at least, the first 26 are...); there are no extraneous white-spaces or linebreaks; there are no comments; and so on.
The benefits of this compiler are clear: pages load faster, JavaScript execution is faster, and as a bonus, competitors will have a hard time understanding your obfuscated code.
Clearly, Google is using some sort of a JavaScript-to-JavaScript compacting compiler. I am wondering if what they're using is an in-house tool? If not, what are they using? Are there any publicly available (ideally, free/open-source) tools of that sort?
YUI Compressor is a Java app that will compact and obfuscate your Javascript code. It is a Java app that you run from the command line (and would probably be part of a build process).
Another one is PHP Minify, which does a similar thing.
Another one is ShrinkSafe that is part of Dojo but may be used stand-alone (either in a build script, command line or at the website):
http://shrinksafe.dojotoolkit.org/
You may be looking for GWT - it's Java-to-JavaScript rather than JavaScript-to-JavaScript, but you may still find it useful.
I can't comment on what internal tool, if any, we use for JavaScript-to-JavaScript. (To be honest, I don't even know offhand... I'd have to look it up before explicitly not telling anyone :)
It's actually pretty unlikely to be JS->JS, much more so to be Java->JS. These days I believe the recommended JS compressor (for this is what they're called) is the YUI compressor, but others like /packer/ exist
Crockford.com's JSMin is one step in that direction, assuming you're only looking for minimization and not obfuscation.

What JavaScript Repository should I use? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Many languages have standard repositories where people donate useful libraries that they want others to have access to. For instance Perl has CPAN, PHP has PEAR, Ruby has RubyGems, and so on. What is the best option for JavaScript?
I ask because a few months ago I ported Statistics::Distributions from Perl to JavaScript. (When I say ported I mean, "Ran text substitutions, fixed a few things by hand." I did not rewrite it.) Since I've used this module a number of times in Perl, I figure that statistics-distributions.js is likely to be useful to someone. So I've put it under the same open source license as the original (your choice of the GPL or the Artistic License). But I have no idea where to put it so that people who might want it are likely to find it.
It doesn't fit into any sort of framework. It is just a standalone library that gives you the ability to calculate a number of useful statistics distributions to 5 digits of accuracy. In JavaScript.
JSAN (JavaScript Archive Network) sounds like the kind of thing you're looking for, but I've never personally used anything from it apart from Test.Builder.
As long as your JavaScript can be dropped in to people's projects without polluting the global namespace or doing things which are liable to cause breakage in other people's code (adding to Object.prototype, for example) I would just stick it somewhere like Google Code as already suggested.
There is no centralized repository for JavaScript. JS Libraries usually have their own plugin-repositories, but for stand-alone scripts, The best way to promote it is to send it to famous website such as ajaxian or mashable
AFAIK, there is no central JavaScript repository, but you might have success promoting it on Snipplr or as a project on Google Code.
You could start a project on SourceForge to contain useful snippets of code like this (or google for snippets to find one).
Perl, Ruby, PHP, etc all have distribution mechanisms built into the language to consume such libraries.
There's not such a thing built into JS.
There are tons of script archives out there - but no "central" JS repo.
Consider packaging it up as a plugin for one of the major Javascript libraries such as jQuery - see http://docs.jquery.com/Plugins/Authoring for more details. This way it can be included on their plugin page which will get it good exposure as they have a huge developer base and it'll be one of their first ports of call when a need arises for such functionality.
Whilst jQuery is one of the most popular frameworks (if not the most) out there, there are a host if other libraries you could consider using in addition to/instead of it.

Categories