thausmann Posted June 25, 2022 Share Posted June 25, 2022 I looked at my HTML output today and all this chaotic whitespace triggered my OCD. This module simply hooks into Page::render and removes whitespaces from frontend HTML with a simple regex replace. I mostly put this together for cosmetics. I like my View source neat and tidy. This is not well tested yet, please open an issue if you run into problems. GitHub: https://github.com/timohausmann/MinifyPageRender 7 Link to comment Share on other sites More sharing options...
ZAP Posted June 9, 2023 Share Posted June 9, 2023 I don't think of myself as OCD, but I sure do love me some minified HTML! I used this module on a recent project and it was plug and play simplicity. But now when I try to install it (after uploading directly to modules or as a zip file), I get a compile error: Look out… Compile Error: Cannot declare class MinifyPageRender, because the name is already in use (line 5 of site/modules/MinifyPageRender/MinifyPageRender.module) This is running ProcessWire 3.0.210 and the same thing happens with debug mode on or off. Any clue why this might happen? Link to comment Share on other sites More sharing options...
thausmann Posted June 9, 2023 Author Share Posted June 9, 2023 @ZAP hmm that's weird, can you search for MinifyPageRender in your project and see if it comes up twice, maybe delete the cache? Searching the forum for this yields some older reports of similar errors, but no definite solution. Link to comment Share on other sites More sharing options...
wbmnfktr Posted June 9, 2023 Share Posted June 9, 2023 At first it did sound like a namespace issue but the module has a namespace so I threw it in a demo instance: No issues so far. Installed without errors, output is minified. ProcessWire 3.0.210, PHP: 7.4, 8.0, 8.1 @ZAP Can you please check that there is no other copy of that module in place. Maybe with a different folder name or something. 1 Link to comment Share on other sites More sharing options...
ZAP Posted June 9, 2023 Share Posted June 9, 2023 Quote @ZAP Can you please check that there is no other copy of that module in place. Maybe with a different folder name or something. Expand Yes! That was it. I somehow had a copy of the module in both wire/modules/ and also site/modules/. I also had a permissions issue (I couldn't delete the extra one until I changed its permissions), but I think that the issue was just that it was in there twice. Maybe the core should check for that when refreshing for new modules? It's kind of a dumb thing to do, and I shouldn't expect PW to keep me from doing dumb things. Can I say how awesome it is that two people investigated this issue for me just since I posted last night? I'm accustomed to forums where replies can take quite a while and may not be all that helpful. I appreciate the energy and solidarity! I'll look for some posts that I may be able to help with as soon as I get done with my day job today. 1 Link to comment Share on other sites More sharing options...
wbmnfktr Posted June 9, 2023 Share Posted June 9, 2023 On 6/9/2023 at 4:30 PM, ZAP said: Maybe the core should check for that when refreshing for new modules? It's kind of a dumb thing to do, and I shouldn't expect PW to keep me from doing dumb things. Expand It actually does... just tested it. But you can - as always - actually miss it. The first time ProcessWire notices this, it's a large notification... from then on it's somewhere hidden. The good thing: most of the time this isn't really an issue. On 6/9/2023 at 4:30 PM, ZAP said: Can I say how awesome it is that two people investigated this issue for me just since I posted last night? Expand Well... yeah, this community is probably one of the best you can find. But to be honest and fair here, not all questions are that easy to solve. Some take a bit more time. 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