0.1.2 • Published 9 years ago

foso-url v0.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

foso-url

A URL creator for the scripts bundled with foso.

Dependency Status Build Status npm version

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)