I was reading a document about npm Developer Guide.
I was wondering if it is possible to write a web client application using javascript/css/html
by using npm?
If yes, are there some example on github?
For example my client web application depends on requirejs, jquery, underscore and backbone
.
Can I use npm
to automatically download, in the vendor directory, the latest version of requirejs, jquery, underscore and backbone
?
If not, are there other tools/methods to accomplish this goal?
HTML pages with server-side JavaScript can also include client-side JavaScript. In contrast to pure client-side JavaScript pages, HTML pages that use server-side JavaScript are compiled into bytecode executable files. These application executables are run by a web server that contains the JavaScript runtime engine.
What is NPM? NPM is the default package manager for node. It is used to install, share, and manage javascript packages in a project.
Using npm to install dependenciesExecute command npm install . This command would read package. json and install dependencies jquery and bootstrap. A new directory called node_modules should have been created and directories jquery and bootstrap should have been created inside node_modules .
npm (originally short for Node Package Manager) is a package manager for the JavaScript programming language maintained by npm, Inc. npm is the default package manager for the JavaScript runtime environment Node.js.
Yeoman uses a package manager called Bower to manage dependencies - the Bower Github page gives an example of downloading jQuery for a project, so this might be useful for your projects.
Okay, now your question becomes clear. Yes, you can use NPM to help you develop JavaScript for the front-end. There are lots of tools available that will make your workflow much smoother. I mentioned jshint and uglifyjs already, but you have grunt to do a bunch of useful tasks, less and sass compilers, and the list goes on. To manage dependencies in CommonJS you'd typically use a package.json.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With