-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Makefiles for (in-place) minification #65
Conversation
👍 It would be a nice feature if the PHP code itself would minify on-demand, e.g. by using https://github.com/smallhadroncollider/uglify-php |
I don't have any specific preference about the minifier. However, I don't believe that we should minify on demand the Javascript sources, because:
However, knock yourself out and send a PR to nbraud/ZeroBin if you want to modify this PR in other ways ;-) |
I agree with dynamic minification not being the thing we want in the way you described it. One of the things I like most about ZeroBin is it's easy to setup. If there will be infrequent releases (as before), users will need to use some kind of GitHub code, in which case they have to minify themselves (which can be difficult). Another solution for that problem would be to use (in the templates) the non-minified JS/CSS, unless the minified files would exist. Minification would be simply a performance-enhancing factor in that case, but purely optional. |
Regarding the implied difficulty involved in minification, I do not believe than a user who managed to pull the code from the repository would have difficulties running Regarding on-demand minimization, please re-read my previous comment, which precisely answers your remark. |
The problem is rather that most users (and Github makes it really simple to just clone a repository) won't have the closure compiler (which requires Java) / Uglify (which requires NodeJS) etc. So while running make by itself would be OK (well, only if you assume the user has make, which is not an assumption you can universally make, see e.g. Windows users), I don't like the idea of the user having to download / install / google something only to get it running, at all. You could do something like that for a large 100kSLOC+ commercial application, but ZeroBin should be easy to use and easy to install also for non-expert users. It's a nice feature that users are able to override ENV vars, but I think while it might be useful for developers, it is not useful to end-users who like to use I, personally, would like to clone directly onto my server, where Java is not installed (for security and backup reasons), and NodeJS might not be installed either. Even if pretty much any server I'm gonna use will have make installed, that is not a general assumption you can make. Imagine the "average" Windows user, that wants to install ZB on his paid PHP webspace. You could argue that this average user might not install ZB himself, but I think a judgement about a software's userspace (which might be partially true at the moment) should never influence how easy it should be to use and setup. I actually do know a fair amount of people who might want to install ZB on their webspace, but who don't use make all the day, and some of them don't really know what environment variables are. I don't think your previous answer (assuming you meant #65 (comment)) really adresses my remark. Sorry if I didn't make my point clear enough before. on-demand might be misleading. As said before, I think it's a bad idea to minify it every time the minified file is needed (cached or not). However I think it's a good idea to auto-minify once (and only once!), on first startup. |
The problem regarding (2) still stands, though:
Lastly, you seem to have lost sight of the fact that ZeroBin works perfectly well without this micro-optimization, and the added complexity of “dynamic” minification vastly outweights any foreseeable benefits. PS: Your comment cut at “the demand arises from adding a” |
Sorry for the cutoff comment, I seem to have accidentally deleted/overwritten something.
You are partially right about that optimization not being neccessary in some cses but let's put it that way:
Again, my minification proposal is not fully dynamic. |
Moreover, I am unwilling to write additional code for this. |
require_once 'uglify.php';
if(!file_exists('js/min.js)) {
minify_js('js/main.js','js/zerobin.js','js/min.js');
minify_css('css/style.css','css/zerobin.css','css/min.css');
} Regarding the PNG optimization, I'd prefer to check in the optimized PNGs into git. You won't debug PNGs, so I can see no reason why ZB should contain the unoptimized versions. The value added, is IMO not dubious whatsoever. Users being able to install stuff without hard work is way more value. I can understand that you don't simply want to extend your code and put additional work in it. However, I think in the current form it defies one of the principles of ZB I consider most important: Simple to install & dependency-free. What you did is not in any way entirely wrong or bad, but I do not want to read source code just to get something running, ever. If I'm not missing something, the neccessity of executing make is not documented in README/INSTALL/whatever. |
Why do not just put the normal and minimized version inside the repository and let the maintainer / community updates the minimized version in the same time of the normal version (possibly with a script inside the repository, but useless to end users) ? It seems both odd to me to add dependencies on install or a bunch of php code just used once . |
I think that would be a solution, there would be quite some overhead but 👍 Am 01.11.2013 01:25, schrieb Valentin Samir:
|
I agree with nitmir, a simple minified version on the repo would be OK. One thing is certain, I wouldn't like to have to install NodeJS (or worse, java) just to enable a minification feature, when ZB itself doesn't have any other dependency than PHP. That's one of the great thing about ZB, let's keep it simple. |
Upstream is nonresponsive. |
Solves issues #60 and #53 (except for the GIF animation).