npm-browser
v1.0.0
Published
install npm packages in browser
Downloads
4
Maintainers
Readme
npm-browser
Install like a node package manager in the browser
Think of this as requirejs but in a lighter version
- Lightweight (1kb)
- No Dependencies
Installation
Unpkg
<script src="https://unpkg.com/npm-browser"></script>
Usage
<script src="https://unpkg.com/npm-browser"></script>
<script>
npm("sweetalert jQuery",(swal,$)=>{
swal("Hello world")
$("body").on("click",()=>{
alert("hello world")
})
})
// Specify the version
npm("[email protected]",(swal)=>{
swal("...")
})
</script>
Packages name must be separated by spaces just like installing a package on npm
TIP: spaces can be many as you want
The base url of this package was https://unpkg.com/ if you dont want the default baseUrl you can change it via:
npm.baseUrl = "https://cdn.jsdelivr.net/npm/"