Understanding npm link

Symlink a package folder. Consider the example where you have test package inside node modules and you want to change in that package. You could make changes in node_modules and manually copy the changes to the git repository of the dependency once you are done. But there is a much cleaner approach: npm link. Package… Continue reading Understanding npm link

Disable right click on web page

One has to use JavaScript to accomplish this. If the user has JS disabled, you cannot prevent the right click. You can do it either by adding an event listener to for the “contextmenu” event and calling the preventDefault() method. Eg: or just by adding “oncontextmenu” to body tag.

Environment Variables in Angular

Need to use different values depending on the environment you’re in? If you’re building an app that talks to the Stripe API for example, you’ll want to use your test publishable key during development and then your live publishable key in production. It’s easy to do in Angular using the environment.ts file. Angular CLI projects already use… Continue reading Environment Variables in Angular

What is the difference between npm and bower?

npm is most commonly used for managing Node.js modules, but it works for the front-end too. Bower is created solely for the front-end and is optimized with that in mind. The biggest difference is that npm does nested dependency tree (size heavy) while Bower requires a flat dependency tree (puts the burden of dependency resolution on… Continue reading What is the difference between npm and bower?