add minify feature in output class? |
hi all,
please correct me if i am wrong, but i think CI doesnt have a minify feature for removing the whitespace chars from the html output before sending it to the browser, right? i see there are numerous libraries out there , but why not have one in the CI "core" as well? it would definitely be useful , and shouldnt be that complicated as well, unless i am missing something here and - needless to say - many thanks for the wonderful CI
It's actually not a bad idea. I could see it breaking people's inline JS, but it might be rare, and then they'd just learn a lesson on how to write better JS.
There is this though: http://stackoverflow.com/questions/53621...-from-html See the accepted answer regarding gzip compression.
(02-29-2016, 04:58 PM)skunkbad Wrote: It's actually not a bad idea. I could see it breaking people's inline JS, but it might be rare, and then they'd just learn a lesson on how to write better JS. well, ok gzip will compress the whole page, but if you have first stripped out the whitespace that would be the ideal. i tried one of the several libraries for minifying and indeed my inline JS got messed up, but without thinking it too much i thought this could be prevented by a better set of conditions in the preg_replace, right? js scripts do get minified and usually are packaged in minified, but again i didnt think of this any further, i was really curious why CI was not providing something on this, and decided to ask here about it
(02-29-2016, 10:47 PM)Narf Wrote: Actually, we tried that and it proved to be a bad idea. i tried some of those libraries and have a feeling i know what you really mean but maybe we could have a standard minify function - well documented too - and then users should make sure their code complies with the "restrictions" to make it work, else they could end up in trouble? just a thought.
(03-01-2016, 01:55 PM)iz_no_good Wrote:(02-29-2016, 10:47 PM)Narf Wrote: Actually, we tried that and it proved to be a bad idea. No, you don't really know what I meant - there literally was a 'minify_output' feature in CI 3.0-dev, for almost 3 years. And as I said, it proved itself to be a bad idea - it's not as easy as saying that we just need better regular expressions. In fact, trying to do it via regular expressions (because that's the easiest looking method) is what makes it a deceptively hard task. It's not a silver bullet. I was quite verbose with the commit message when the feature was removed: https://github.com/bcit-ci/CodeIgniter/c...14c6d7cbc8 ... and that's final.
(03-01-2016, 03:38 PM)Narf Wrote:(03-01-2016, 01:55 PM)iz_no_good Wrote:(02-29-2016, 10:47 PM)Narf Wrote: Actually, we tried that and it proved to be a bad idea. ok.. now i understand .. "better", thank you for the details
Hello..
I just made a library called "CI_Minifier". https://github.com/terrylinooo/CodeIgniter-Minifier Maybe it can help or give you more idea.
Personal blog: https://terryl.in
My personal project is called Dictpedia is currently using Codeigniter 3, welcome. |
Welcome Guest, Not a member yet? Register Sign In |