loadjs icon indicating copy to clipboard operation
loadjs copied to clipboard

Add .path() method like on $script.path()

Open yourchoice opened this issue 6 years ago • 3 comments

Add .path() method like on $script.path()

yourchoice avatar Sep 10 '18 09:09 yourchoice

I can see how this would be useful but you can already do this by prefixing the paths yourself (you can also use a before callback function). I'm curious to see how many other people have this problem. Unless it's a common issue, my preference is for keeping the LoadJS feature set to an absolute minimum.

amorey avatar Sep 11 '18 08:09 amorey

I say in idea if there are many files to load in same path to reduce the code:

loadjs(['foo.js', 'bar.js'], 'foobar', { 'path_prefix': '/path/to/' });

yourchoice avatar Sep 11 '18 08:09 yourchoice

If you'd like to start doing this now you can use the before callback:

loadjs(['foo.js', 'bar.js'], 'foobar', {
  before: function(path, scriptEl) {scriptEl.src = '/path/to/' + path;}
});

amorey avatar Sep 11 '18 10:09 amorey