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

  On 4/4/2025 at 8:48 AM, bernhard said:

Ok then it means you are missing the ProcessWire namespace on the _init file πŸ˜‰ 

Expand  

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...

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...