Martijn Geerts Posted April 19, 2021 Author Share Posted April 19, 2021 Hi Marc, I quit my job as developer. I really wanted to work in the outside air and with my hands again. I'm building garden sheds these days and I love it. Maybe someone wil take over some modules I made in the past. 16 Link to comment Share on other sites More sharing options...
Macrura Posted April 19, 2021 Share Posted April 19, 2021 Hi Martijn, That's great to hear! Sorry for bringing up this old module, but thanks for the reply. I'll see if i can dig into the code and make it work... 2 Link to comment Share on other sites More sharing options...
bernhard Posted April 20, 2021 Share Posted April 20, 2021 Why not just add the file via hook? https://processwire.com/talk/topic/20725-add-possibility-to-prepend-or-append-scripts-and-stylesheets-in-admin/?do=findComment&comment=211800 $wire->addHookBefore('AdminTheme::getExtraMarkup', function (HookEvent $event) { $config = $this->wire->config; $url = $config->urls("MyModule"); $config->scripts->add($url."tabulator/js/tabulator.min.js"); $config->styles->add($url."tabulator/css/tabulator.min.css"); }); 2 Link to comment Share on other sites More sharing options...
adrian Posted April 20, 2021 Share Posted April 20, 2021 Or, if you are already running AdminOnSteroids, it lets you easily load js and css files in the admin. Link to comment Share on other sites More sharing options...
Macrura Posted April 20, 2021 Share Posted April 20, 2021 Thanks @bernhard & @adrian for the alternatives. I actually use ACF on a lot of sites as part of my standard setup; I think this subdomain thing on MacOS can be solved. I'll give AOS loading a try on a setup and see how it compares to ACF... Link to comment Share on other sites More sharing options...
bernhard Posted April 20, 2021 Share Posted April 20, 2021 @adrian I'd ask you to rethink recommending AOS for such simple tasks as adding scripts to the admin. I know you are a big fan of it, but the only reason I see for using AOS or ACF is if you don't know how to place a hook to your system. But if you are able to do that, it is a lot better to copy a 4line hook than adding another dependency to your site. The hook will likely work without any problems for several years... AOS is already unmaintained and has introduced problems to several of my sites that where quite hard to find... It would be even better of course to put that hook into a dedicated simple module that does everything that the injected script is for ? 2 Link to comment Share on other sites More sharing options...
adrian Posted April 20, 2021 Share Posted April 20, 2021 @bernhard - I completely agree that there is no point using AOS for just this purpose. That was my intention by saying "if you are already running" in my comment above. I know it's unmaintained, but with the features I use from it, I haven't noticed any bugs - I am sure there are likely some features that are buggy. The problem is that I really struggle to use PW without it. Just an FYI - when it was first being developed, I thought it was a crazy idea - way too hard to maintain and make stable with all those features, but it works for my needs, but I completely agree it's not something that should be recommended for one simple feature like this. 3 Link to comment Share on other sites More sharing options...
horst Posted April 20, 2021 Share Posted April 20, 2021 On 4/19/2021 at 7:03 PM, Martijn Geerts said: I really wanted to work in the outside air and with my hands again. I'm building garden sheds these days and I love it. ? sounds good! ? All the best for you! ??? 1 Link to comment Share on other sites More sharing options...
MarkE Posted April 20, 2021 Share Posted April 20, 2021 On 4/18/2021 at 5:39 PM, Macrura said: the root relative url is presumably "/processwire_test1/site/templates/libraries/path-to-some-file.js" but the module outputs this: processwire_test1/processwire_test1/site/templates/libraries/path-to-some-file.js FWIW, I came across a similar problem with my DbMigrate module. In my case, it happened if the admin root was not just /processwire/. My solution was to use $pages->get(2) rather than $urls->admin for the admin root. This may be completely irrelevant in your case, of course ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now