Jump to content

uliverse

Members
  • Posts

    49
  • Joined

  • Last visited

Posts posted by uliverse

  1. 26 minutes ago, bernhard said:

    The --watch command is fine and as I said most likely what 99.9% of tailwind users do. I don't like it, because it does not recompile the css in the way "npm run build" does. It has some caching, so if you add classes during dev and then remove them, they stay in your css, which I don't like, because I want to immediately be able to "git commit" my changes without having to run "npm run build" before (and likely forget that).

    I see... Makes sense.

    25 minutes ago, bernhard said:

    I don't know why you added components here, but if you need them go ahead. The problem with adding anything other than what I do in the site profile is that these things often interfere with UIkit or whatever framework you use. If you don't use one and use only tailwind then of course you'll likely want to add components as well.

    For me all the necessary tailwind magic comes from the utility classes. Everything else I'm using UIkit for.

     I just followed the instructions in the tailwind docs... This is all new to me.   😄

     

    • Like 1
  2. I think I have to give up on exec at this point, this is way over my head... The problem seems to be that the exec function can't be called in my MAMP environment, not even when I add the full path to the npm script.

    However I found that tailwind comes with a "--watch" command to monitor any changes. And this works! I guess only until the console is closed, but better than manually initiating the build command with every change... I run a command like this: 

    npx tailwindcss -i ./input.css -o ./site/templates/bundle/tailwind.css --watch

    The input.css looks like this:

    @tailwind base;
    @tailwind components;
    @tailwind utilities;

    I'm sure I totally messed up your setup, but it seems to work.

    I was also wondering if the standalone CLI might not be easier to install for most people on shared hosting...

  3. Well, I did some more testing and found that the exec function is actually available.

    I added this code to my page:

    <?php
        $function_name = "exec";
        if ( function_exists($function_name) ) {
            echo "$function_name is enabled";
        }
        else {
            echo "$function_name is not enabled";
        }
    ?>

    As you can see on the screenshot, the result is positive...

    Don't get me wrong: I am not trying to ask for your help in my specific case. I believe in your product and I want to help make it usable for as many people as possible!

    1497633208_Screenshot2024-10-01at10_11_19.jpg.a4d675364462d3c23262cc548055184a.jpg

    • Like 1
  4. 42 minutes ago, bernhard said:

    Hey @uliverse thx for that screenshots. I was able to reproduce the issue when installing PW in a subfolder. I never do that, so it causes trouble more often that I'd like, because I don't realise if anything doesn't work.

    Your issue is fixed now in the latest version 3.21.1

    This works for me in my subfolder installation, so my guess is that exec() is not available in your setup?

    Could you try this /site/livereload.php ?

    <?php
    
    namespace ProcessWire;
    
    /**
     * This file will be loaded by RockFrontend whenever livereload detects
     * a change in the source files. By default it will run npm run build to compile
     * the css from tailwind, but you can add other commands to run other scripts
     * like running tests or linters as you need.
     *
     * If you are not using Tailwind or you don't need to compile anything, you
     * can remove this file.
     */
    
    if (!defined('PROCESSWIRE')) die();
    
    // early exit if not in debug mode or livereload is not enabled
    if (!wire()->config->debug) return;
    if (!wire()->config->livereload) return;
    
    // run npm build to compile css from tailwind
    // check if exec is available and allowed
    if (function_exists('exec') && !in_array('exec', explode(',', ini_get('disable_functions')))) {
      exec('npm run build');
    } else {
      rockfrontend()->getLiveReload()->log('exec() not available');
    }

    Or in Tracy try this:

    sGfisAE.png

    What does it show?

    I have changed the livereload.php, but the result is the same.
    In Tracy I get

    array (0)
  5. I cleared the database and re-installed everything (local MAMP installation), but the problem persists. I am going the traditional way: download Processwire, download SiteRockfrontend, move the site-rockfrontend folder into the root folder and install PW with Rockfrontend as site profile. Then run "npm install -D" in the root folder of the project. My installation looks like the screenshot now.

    1443155241_Screenshot2024-09-30at16_08_41.jpg.f0beb3899eb3ab11218328f824378793.jpg
    The relevant part of livereload.php looks like this:

    if (!defined('PROCESSWIRE')) die();
    
    // early exit if not in debug mode or livereload is not enabled
    if (!wire()->config->debug) return;
    if (!wire()->config->livereload) return;
    
    // run npm build to compile css from tailwind
    exec('npm run build');

    The fronend is reloading after a file change, but the tailwind.css is not being recreated. If I manually execute "npm run build" it works. Is it possible, that the exec command is run in the site subfolder and therefore not working correctly?

    About the topbar: the path to the topbar.css is not correct:
    1992326178_Screenshot2024-09-30at16_12_15.thumb.jpg.a0ae98ab5faea49639adb4efeb11e127.jpg

     

  6. Nice work! Tailwind is installing correctly now. Only the Topbar still gives me trouble, since the topbar.css is also not linked correctly. This is a minor issue, since the fronend editing module is not essential. But still...

    I noticed that tailwind.css is only generated ONCE. When I change the main.latte template again (to "bg-green-500" p.e.) the css file is not re-created... Is there anything I need to enable for the tailwind.js to work correctly?

    Screenshot 2024-09-30 at 13.25.23.jpg

  7. So I managed to install the npm packages in the root folder of my project (I guess this is where "site" and "wire" also live). However, the topbar.min.css is not loading and the H1 is not turning red. I found that the path to the topbar.min.css is not correct: 

    /pwrockfrontend/pwrockfrontend/site/modules/RockFrontend/topbar/topbar.min.css

    instead of 

    /pwrockfrontend/site/modules/RockFrontend/topbar/topbar.min.css

     

    Screenshot 2024-09-15 at 18.10.51.jpg

  8. Hi.

    In my template I call images the standard way ($image = $event_item->page_image->size(640, 480, $options); $options are defined as well in the template, of course. Caching is enabled for the template in use.

    On desktop this works normally. But on mobile browsers I get strange behaviour: after changing an image on a page, the new image shows up on desktop, but not on mobile. Only after clearing cache (PageRender module) the correct image shows up...

  9. I am trying to implement the search function from the demo into my website. I run into errors, though.

    My search.php template starts like this:

    Quote

    <?php namespace ProcessWire;

    // look for a GET variable named 'q' and sanitize it
    $q = input()->get('q');

    // sanitize to text, which removes markup, newlines, too long, etc.
    $q = sanitizer()->text($q);

    Already at line 4 it throws an error:

    Quote

    Fatal Error: Uncaught Error: Call to undefined function ProcessWire\input()...

    I am lost... What am I doing wrong? It somehow must have to do with Processwire syntax, but the code is taken directly from the demo... so why wouldn't it work?

  10. Here I am, once again...

    I noticed that repeaters won't keep their order in the backend after dragging them into a new order. They will always return to the original order in which they were created in after saving. Is that a bug or is there a setting I have missed? I seem to remember that this used to work... I am currently on 3.0.123.

    Help appreciated!

  11. 1 minute ago, adrian said:

    You could make use of http://modules.processwire.com/modules/process-admin-actions/ and build a custom action that lets you choose a Page Table field and then a page to add to that field.

    Or you could use http://modules.processwire.com/modules/fieldtype-runtime-markup/ and build a page selector field just above or below the Page Table field and on pag save, process the selected page and add it to the PT field.

    You could also hook into InputfieldPageTable::render and add the page selector interface there.

    Lots of options really ?

    Hmmm... I will look into those options! Thanks a lot! You are always very helpful.

  12. 3 minutes ago, adrian said:

    The code in that link I posted hooks into the rendering of the page table field in the backend and automatically adds existing child pages. Is that not what you are looking to do?

    Yes and no... it's a bit more complicated I guess... I need to be able to do this manually. If there is no simple solution, I will find a workaround. Thanks for your help, though!

×
×
  • Create New...