dynamic-base
A utility that automatically sets the base href to the origin
Compatibility
Currently tested working on
- Firefox
- Chrome
- Safari
- IE11+
- iOS
Installation
yarn add dynamic-base
via yarn: npm install dynamic-base
via npm : Example Usage
Given https://dynamic-base.com:8080/some/suffix/here/other/stuff
Will automatically append a base tag with the appropriate origin / port to the HEAD tag
becomes
When no suffix is specified, it will be defaulted to an empty string.
This is useful for sites that are deployed to many different origins but require a specified base href. I have personally had a need for this in angularJS html5mode, but I'm sure there are other applications.