foso-url

0.1.2 • Public • Published

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)

Readme

Keywords

Package Sidebar

Install

npm i foso-url

Weekly Downloads

1

Version

0.1.2

License

MIT

Last publish

Collaborators

  • zkochan