Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Absolute paths to Trigger.io assets?

Tags:

trigger.io

We're building a Trigger app with Chaplin underneath. It would be nice, for development purposes, if we could use absolute paths to our assets, a la:

<link rel="stylesheet" href="/_forge/stylesheets/app.css">
<script src="/_forge/javascripts/vendor.js"></script>
<script src="/_forge/javascripts/app.js"></script>

Is it possible to do this in Trigger?

like image 845
Ian Greenleaf Young Avatar asked Apr 29 '26 04:04

Ian Greenleaf Young


1 Answers

Unfortunately different platforms have different URLs on Trigger (due to them having their own features and limitations).

If you want to get absolute paths you can use the file module and do something along the lines of:

forge.file.getLocal("js/app.js", function (file) {
    forge.file.URL(file, function (url) {
        $('body').append('<script src="'+url+'"></script>');
    });
});

I'm not sure why an absolute path is useful though, I would recommend only using one html page (index.html) as navigating to a new page is slower on the phone than changing the dom using javascript. In which case all of your relative paths should always be the same.

like image 104
Connorhd Avatar answered May 04 '26 21:05

Connorhd