riot-starter/docs/dependencies.md

39 lines
1.7 KiB
Markdown

# Frontend Dependencies
I've always been hesitant using NodeJS for client-side dependency managment, but the `npm` package [frontend-dependencies](https://github.com/msurdi/frontend-dependencies) takes that away, and I did not want to commit any external vendor code here.
With [frontend-dependencies](https://github.com/msurdi/frontend-dependencies) we can pull in just the dependency files we need, not an entire `node_modules` directory of cruft. Infact, nothing is put into the `node_modules` directory! By default, I just pull in 2 files for each dependency ( the develpment and the minified version)
## Get Started
Running `npm install` will install all the production build dependencies for when you need them and as a `postinstall` hook, will populate the `src/public/vender` directory will all the client-side dependencies. These are name-spaced.
You can add or remove dependencies from the `package.json` file. Client-side dependencies are configured under `frontendDependencies`, which looks something like
```
"frontendDependencies": {
"target": "src/public/vendor/",
"packages": {
"riot": {
"version": "3.13.2",
"src": "*min.js",
"namespaced": true
},
"riot-route": {
"version": "3.1.4",
"src": "dist/route.*",
"namespaced": true
},
"grayscale": {
"src": "dist/*",
"url": "https://github.com/n2geoff/grayscale",
"namespaced": true
}
}
}
```
I found this to be, currently, the simplest way to manage client-side dependencies.
[Learn More](https://github.com/msurdi/frontend-dependencies) on the github page for the lib