Asset management

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: Asset management

Post by callumacrae »

Assetic:
Screen Shot 2015-06-01 at 14.52.51.png
179 issues, 84 PRs, 3009 stars

Gulp:
Screen Shot 2015-06-01 at 14.53.59.png
35 issues, 4 PRs, 13,978 stars
Made by developers, for developers!
My blog

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: Asset management

Post by brunoais »

callumacrae wrote:
brunoais wrote:What do we really need or could use of that the tools made in javascript provide in special, actually?
I actually made a topic with a list of things, you should check it out!

Oh yeah, it's this one.
Let's see, then...
callumacrae wrote: - Icons and smileys should be a spritesheet.
I made a piece of code in less than 1h that does just that in pure PHP with only what comes in default PHP. I tested and it works as expected.
callumacrae wrote: A few things that can be done to make development easier:
- Autoprefixer can be used to make sure we don't have to worry about browser prefixes.
https://github.com/peteboere/css-crush/ & compatible with composer. It also has some other bits and whistles you may think interesting. I'm not interested in most, though.
callumacrae wrote: - rem fallbacks can be added automatically—adding them manually defeats the point, is ugly, and is maintainability hell.
If we drop support on IE8, all modern browser support rem. Otherwise, we can use a preprocessor and mixins for that. css-crush has mixins. On the other hand, we also have phpless which is actively updated.
callumacrae wrote: - Linting tools can be ran without needing to install editor plugins, and it can also be ran on Travis.
I don't think there's any need for this to come with phpBB. There's no need to lint code written for private use or for extensions. IMO, the current jsHint/jsLint configuration file is enough.
callumacrae wrote: - ∞
No specific element... I can't answer.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: Asset management

Post by callumacrae »

brunoais wrote: I made a piece of code in less than 1h that does just that in pure PHP with only what comes in default PHP. I tested and it works as expected.
Fair enough.
brunoais wrote: https://github.com/peteboere/css-crush/ & compatible with composer. It also has some other bits and whistles you may think interesting. I'm not interested in most, though.
You're suggesting loading an entire preprocessor just for autoprefixing?

It supports nowhere near as many things as autoprefixer.
brunoais wrote: If we drop support on IE8, all modern browser support rem. Otherwise, we can use a preprocessor and mixins for that. css-crush has mixins. On the other hand, we also have phpless which is actively updated.
actively maintained = no commits in 2015?
brunoais wrote: I don't think there's any need for this to come with phpBB. There's no need to lint code written for private use or for extensions. IMO, the current jsHint/jsLint configuration file is enough.
You think everyone who contributes JavaScript to phpBB should have to install two editor plugins for linting, and you disagree with running the JavaScript linting on Travis?

I will assume from your silence that I was right about there not actually being any good minifiers available for assetic.
Made by developers, for developers!
My blog

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: Asset management

Post by brunoais »

callumacrae wrote:
brunoais wrote: https://github.com/peteboere/css-crush/ & compatible with composer. It also has some other bits and whistles you may think interesting. I'm not interested in most, though.
You're suggesting loading an entire preprocessor just for autoprefixing?
Nope. Just mentioning one because you mentioned you were unable to find any.
callumacrae wrote: It supports nowhere near as many things as autoprefixer.
Which things you think are useful that it doesn't support?
callumacrae wrote:
brunoais wrote: If we drop support on IE8, all modern browser support rem. Otherwise, we can use a preprocessor and mixins for that. css-crush has mixins. On the other hand, we also have phpless which is actively updated.
actively maintained = no commits in 2015?
Yeah, good point. I saw that wrong. css-crush can do that work, regardless.
callumacrae wrote:
brunoais wrote: I don't think there's any need for this to come with phpBB. There's no need to lint code written for private use or for extensions. IMO, the current jsHint/jsLint configuration file is enough.
You think everyone who contributes JavaScript to phpBB should have to install two editor plugins for linting, and you disagree with running the JavaScript linting on Travis?
Why the plugins?
Where did you get the idea that I disagree on running jslinting on Travis?
Why can't we just keep the definitions file to whom likes to do the linting himself? I must say that I think that phpBB itself shouldn't have code to do the linting. There's no need to. You already made the definitions file for JsLint (I think that's the one). We can just keep it for Travis and for whom wants to do it on their own development environment.
callumacrae wrote: I will assume from your silence that I was right about there not actually being any good minifiers available for assetic.
JShrink + CssMin?
Or... minify?
Those are in alternative to google's ClosureCompiler.

P.S. It doesn't have to be Assetic, it never has. Being assetic is a suggestion I had thrown years ago while it was still actively maintained.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: Asset management

Post by callumacrae »

JShrink would probably work, but it doesn't look like it does very much. It doesn't even change variables names, which is a pretty essential feature for a minifier. Same with minify.

CssMin doesn't have tests, and so just isn't an option.

Why do you think front-end development tools written by non-front-end developers would be anywhere near as good as the tools written by the people who actually use them?
Made by developers, for developers!
My blog

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: Asset management

Post by brunoais »

I don't.
What I think is that phpBB should be doing that job, not someone or something that packs it to send to it.
I'm a believer that it should be possible to do edits to phpBB's template files and see the result when, what you have in hand, is simply a text editor no more powerful than windows' notepad, an updated browser and a server capable of running PHP somewhere.
I also think that limiting the minimizing work to javascript code (one of the least used languages for servers) is a very badly thought idea. Unfortunately, that's what has been happening.

Regardless, it is supposed to be used as an alternative to google's ClosureCompiler. If ClosureCompiler is used, then all those complaints are moot.

Additionally, with the amount of JS and CSS, phpBB is OK at this point. By doing concatenating, some minimizing and by gzipping, we don't even need much more squeezing by changing the variable names. We are entering in the same realm as jQuery vs no-lib (in terms of performance). IMO, it's best to not have that minor extra optimization and allow phpBB to be more direct to edit and manually test than having to deal with a console script working all the time to provide a server service for the ever-changing files while working on the interface and reloading the page. I could tell you the amount of %"#$"#%"$# I had with that console window open where the script there was not being run right.

CHItA
Development Team
Development Team
Posts: 169
Joined: Thu Mar 12, 2015 1:43 pm
Location: Budapest, Hungary

Re: Asset management

Post by CHItA »

brunoais wrote:IMO, it's best to not have that minor extra optimization and allow phpBB to be more direct to edit and manually test than having to deal with a console script working all the time to provide a server service for the ever-changing files while working on the interface and reloading the page. I could tell you the amount of %"#$"#%"$# I had with that console window open where the script there was not being run right.
I don't think that minifying any assets would stop someone from doing what you've described. If the not minified versions of these assets are still included in the package, then I would think that the administrator, who is brave enough to modify anything will have the skills to modify the asset inclusion code as well (or add a separte CSS or JS file). For the non-tech administrators it does not make any difference (google "A short description of your forum"), and for their users who are visiting from bad mobile connections every bit could count.

Also, I see this more as a packaging issue, so when releasing the code, assets get minified and that is that. If that's the case, I guess the phpBB front-end devs should use whatever tools they like.

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: Asset management

Post by brunoais »

I'm not against allowing whomever develops the frontend use the tools they prefer to write the code or the markup.
I've dealt with many, many different skill levels of script kiddies. I can tell you there's a large amount that can twickle some HTML and CSS... Maybe dealing with some copy&paste for jQuery but they don't know how to program. Disconnecting the PHP code related to accessing the minified version and changing it to use the non-minified version and then wanting it to work is really too much for most non-webdev forum admins who want it done.

Believe me, being a software user and being able to tweak it without the need to install X + Y + Z then B on Z and all those requirements they have (some solved automatically and some manually) is great because they are, actually, a source of frustration for anyone that doesn't do webdev, at least, as a hobby.
Personally, I still don't like that I had to install a javascript processor (AKA Node) and then install multiple programs on it. If I want to participate in some projects, I have no choice. If you want to allow freedom of choice on what tools phpBB tweakers and devs may use to develop on it and build into a result, with tool requirements, such as Node is not a way to do it.
Instead, we may give them more ease of choice by making a definitions file they can use with their npm program (e.g. gulp/grunt) to have their excellent compression result and have our own asset management (it doesn't need to be developed in-house) which gives a good result.

Besides, that big thing of js compressing only became a large race to get the best compression when js became files of >500KB for a single webpage on a website.
Here's some examples, phpBB is now at around 200-300KB and we are not optimizing to when scripts should load and phpBB isfully usable without javascript. ABC's website frontpage requires downloading ~700KB before the page is usable while trying to use techniques to try to minimize its impact. Twitter loads ~1.5MB of javascript, facebook loads ~2MB of javascript.
Those big websites are the ones that desperately need to minimize javascript to try to keep loading times usable. They also have 1 other major thing that differs here. phpBB is an open source program, those are closed source and developed by their own devs. We should make phpBB accessible to as many people as possible, hence jQuery, CDI, twig... The templates are compiled by code that is part of phpBB, written in PHP, not an external tool. For those websites, I'm quite sure they use an external tool, probably in the automatic deploy process, that doesn't go to their website's server.

Do you still think we should require more tools than a text editor to modify and have phpBB working and that modifying non-code markup should require php coding skills to redirect the links from the minimized versions?

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: Asset management

Post by callumacrae »

We have an opportunity to literally halve the load time of phpBB, and doing these things really would help.

Most of your points are invalid. Obviously I don't want to make it trickier for users to modify their sites.
Made by developers, for developers!
My blog

CHItA
Development Team
Development Team
Posts: 169
Joined: Thu Mar 12, 2015 1:43 pm
Location: Budapest, Hungary

Re: Asset management

Post by CHItA »

brunoais wrote:Do you still think we should require more tools than a text editor to modify and have phpBB working and that modifying non-code markup should require php coding skills to redirect the links from the minimized versions?
If I understand correctly, you're saying that the phpBB core should have the tools to minify JS and CSS right? My point is, there is no need because of the reasons I wrote above. If an admin wants to copy paste something from stackoverflow, they can still do that, and if they know any compressor, they can use them, or just edit the not compressed assets, and edit the inclusion code. I cannot really imagine if someone got the knowledge to modify any assets that they wouldn't know how to modify the corresponding HTML tags.

And if I understand callumacrae correctly, then his aim is, when shipping phpBB it should come with minified assets, which would work faster to anyone who have not modified or does not want to modify assets.

Post Reply