Jump to content

RockDevTools - A Fresh Start for Development Tools (AIOM + LiveReload)


bernhard
 Share

Recommended Posts

Hi everyone!

I've started working on a new module that contains development tools like asset minification. Why a new module when RockFrontend and RockMigrations already have similar features?

I wanted to start fresh to make the code cleaner, and most importantly make it work properly with template cache! The old implementation in RockFrontend using page render hooks simply couldn't handle that.

The module is intended for development-only and should be disabled on production. The idea is to create minified assets while developing and then push the minified assets to production and there just include them in your markup!

LiveReload has also been moved from RockFrontend to this module. It's simply not a frontend-tool but rather a development tool! Using RockMigrations, for example, I'm always using the LiveReload feature on the backend, so it does not really make sense to have it in the frontend module 🙂 

Download & Docs: baumrock.com/RockDevTools

  • Like 9
Link to comment
Share on other sites

  • bernhard changed the title to RockDevTools - A Fresh Start for Development Tools (AIOM + LiveReload)
  • 4 weeks later...

I set the configuration as instructed $config->rockdevtools = true.

Yet still there is no config UI or evidence in the dashboard of rock dev tools anywhere besides the module install screen.

I even tried commenting out the 2 lines in the module's source code that exit early if $config->rockdevtools is not true. 

Any ideas on troubleshooting to get this module to appear in the ui?

Link to comment
Share on other sites

Not sure I understand your message. RockDevTools does not provide a UI. It provides an API to minify/merge assets and it provides SSE based live reload for your local pw development.

Link to comment
Share on other sites

  • 1 month later...

Hi @bernhard i have a question about porting old projects that used the asset bundling and minification from RockFrontend the new method in RockDevTools.

My problem is that i get this error message on every project, after installing RockDevTools and trying to merge and minify my assets in my _init.php:

Error

Call to undefined function rockdevtools()

My _initp.php looks like this:

<?php
/**
 * Initialization file for template files 
 * 
 * This file is automatically included as a result of $config->prependTemplateFile
 * option specified in your /site/config.php. 
 * 
 * You can initialize anything you want to here. In the case of this beginner profile,
 * we are using it just to include another file with shared functions.
 *
 */

include_once("./_func.php"); // include our shared functions

if ($config->rockdevtools) {
    $devtools = rockdevtools();

    // force recreating of minified files on every request
    //$devtools->debug = true;

    // parse all less files to css
    $devtools->assets()
        ->less()
        ->add('/site/templates/styles/less/uikit/_custom-import.less')
        ->add('/site/templates/styles/less/project/*.less')
        ->add('/site/templates/styles/less/custom/*.less')
        ->add('/site/templates/RockPageBuilder/**.less')
        ->add('/site/templates/RockPageBuilder/*.less')
        ->save('/site/templates/styles/styles.css');

    // merge and minify css files
    $devtools->assets()
        ->css()
        ->add('/site/templates/styles/styles.css')
        ->save('/site/templates/styles/styles.min.css');

    // merge and minify JS files
    $devtools->assets()
        ->js()
        ->add('/site/templates/uikit/dist/js/uikit.min.js')
        ->add('/site/templates/uikit/dist/js/uikit-icons.min.js')
        ->add('/site/templates/scripts/main.js')
        ->save('/site/templates/scripts/scripts.min.js');
}

 

Link to comment
Share on other sites

40 minutes ago, bernhard said:

Ok then it means you are missing the ProcessWire namespace on the _init file 😉 

This does not help either 😞

I have the feeling this in in my case a somehow cache-related problem (if that is even possible?) after tinkering with the namespace (and removing it again) in the _init.php and the included _func.php it is working now. Even without the namespace (?).

Link to comment
Share on other sites

  • 4 weeks later...
On 4/27/2025 at 3:45 AM, rastographics said:

Sorry but I'm excited to try this module for live reload in my dev environment and I've followed the only instructions I can find (at https://github.com/baumrock/RockDevTools/tree/main/docs).

1. Install the module

2. Add $config->rockdevtools = true; to the config.php file.

 

Now...how do I enable live reload? 

Live Reload should be enabled by default, if you activate rockdevtools in the config file. That's basically all you need to do.

It can be customized, too:

https://www.baumrock.com/en/processwire/modules/rockdevtools/docs/livereload/

  • Thanks 1
Link to comment
Share on other sites

Thank you @Stefanowitsch I didn't know there was documentation existing for this! I knew there had to be something I was missing.

 

I know RockDevTools is running now because I see the sse request in the browser console. but it gets a 404. any ideas the next place i can look at?

image.png.048e5ff0408a3659e076809c52444076.png

 

@bernhard, it may be helpful for others who find your module in the Modules Directory if there was a more direct reference to the docs on baumrock.com?

Right now, the RockDevTools Module page just says "see docs folder", at which point I just think to go to github and look at the docs folder, which also has no reference to the baumrock documentation.

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...