foso-url
v0.1.2
Published
A URL creator for the scripts bundled with foso.
Downloads
13
Readme
foso-url
A URL creator for the scripts bundled with foso.
Installation
npm install --save foso-url
Usage
Lets say you have a directory structure like this:
my-project
└── homepage
├── chat-box
│ └── index.bundle.js
└── main.bundle.js
And you want to add a link to the /my-project/homepage/chat-box/index.js
from
/my-project/homepage/main.js
. How can you possibly know on what domain will
your bundled scripts hosted? You can use Fosify URL to generate the correct URL
for you. So this is how main.js
will look like:
var furl = require('foso-url')(__dirname);
var chatUrl = furl('./chat-box/index.js');
document.write('<script src="' + chatUrl + '"></script>');
##License
The MIT License (MIT)