Updated logic for pulling in js libraries

Signed-off-by: Marcin Wiatr <mail.wichura@gmail.com>