javascript - Web Worker - How to reference worker file when packaged with Bower -


i'm writing small javascript text expansion library. library use web worker , packaged bower. when installed via bower parser script not found (i 404) because browser looking relative root of consuming site , not relative bower script being consumed (both scripts contained in same folder). appears correct behavior.

my question: how should workers used in combination bower such required scripts can loaded without hard-coding bower_components/ path?

function expander(args) {     ...     this.parser = 'parser.js';     this.worker = new worker(this.parser);     ... } 

i use grunt. gulp might bit easier starting out since can debugged missing key component needs. there set of libraries wiredep, build-file , watch enable wanting do. wiredep watches bower directory , automatically add js files dependencies in bower.json html , watch can configured watch type of file in directory change. build-file enables configure template , pass variables use dynamically build js file. can use abilities of grunt correct application path , point file.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -