Skip to content

Instantly share code, notes, and snippets.

@danopia
Last active August 29, 2015 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danopia/d3e23b741fa58b65d92d to your computer and use it in GitHub Desktop.
Save danopia/d3e23b741fa58b65d92d to your computer and use it in GitHub Desktop.
Bower components / asset server for Meteor that avoids the intense hot push delays

This route mitigates meteor #3373.

If you aren't experiencing that issue, you don't need this coffee.

To use

$ meteor add patte:mime-npm # and iron:router if you don't use it yet

Also, move your bower folder to .bower_components, right in the root/top of your project (or change the path). Then copy in the assets.coffee file below.

fs = Npm.require 'fs'
Router.map ->
@route 'bower',
path: '/bower_components/:path(.*)'
where: 'server'
action: ->
path = "#{process.env.PWD}/.bower_components/#{@params.path}"
@response.writeHead 200, 'Content-type': MIME.lookup(path)
@response.end fs.readFileSync path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment