Skip to content

Instantly share code, notes, and snippets.

@winnab
Created November 11, 2014 12:04
Show Gist options
  • Save winnab/3b947ac93dca0cd1203c to your computer and use it in GitHub Desktop.
Save winnab/3b947ac93dca0cd1203c to your computer and use it in GitHub Desktop.
Using local bower and npm packages while developing

Use a local version of a project in another local project

Example

  • I need to make local changes to blamo-awesome-project-npm-pckg.
  • I need to make local changes to blamo-awesome-project-bower-pckg.
  • I need to see the changes locally in blamo-awesome-project.
npm
# https://www.npmjs.org/doc/cli/npm-link.html

# go to local project folder where you want npm to use the local package
$ ~: cd project_dir

# remove the package from node_modules
$ project_dir: rm -r node_modules/package_name

# go to folder of local package you want to use
$ project_dir: cd package_dir

# create the link for the package
$ package_dir: npm link .

# go to back to destination 
$ package_dir: cd project_dir

# link local package
$ project_dir: npm link package_name
bower
# https://oncletom.io/2013/live-development-bower-component/

# go to folder of local package you want to use
$ ~: cd package_dir

# create the link for the package
$ package_dir: bower link

# go to local project folder where you want bower to use the local package
$ project_dir: bower link package_name

# you now point the project to the local package
# in order for your project to see the changes to local package, 
# you need to gulp build in your package directory 
# gulp watches builds, not individual package files
$ package_dir: gulp build

# you can now go to the project_dir and run entry 
# you will see the changes reflected in lib.js file
$ project_dir: gulp watch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment