[Qt-qml] Tool to pack / minify content of QML files ?

Gregory Schlomoff gregory.schlomoff at gmail.com
Mon Jan 3 10:37:48 CET 2011


Hello Kai, thanks for your reply.

Well, I'm not sure what are the use cases for non-embedded QML, since
we've never done that, but I'd say in those cases the build workflow
is very different. I'm not even sure qmake would get into the party,
so yes, I'm putting those cases aside.

Your point about debugging the QML files is valid, but isn't an
obstacle in my opinion. All we need is a command-line flag in rcc
(that would be needed anyways), to specify whether to pack the js and
qml files or not, and this flag would be setted according to the debug
flag.

>Why not do the compression once when you do the final build of your app?

This is an option, indeed, but it is critical for us to have a
one-command build step. We don't want to have to remember to run such
a tool before each release build. So we would need a tool that
integrates into the qmake build process, and after looking quickly at
the problem, it became apparent that we would have to do things like
parsing the .qrc file, etc... Which is why we thought it belonged to
rcc.

So, we took the liberty to make a quick patch to rcc that minifies .js
and .qml files with the JSMIN algorithm. If anyone is interested,
here's the patch : https://github.com/betterinbox/QMLMin/

Cheers,

Greg

On Mon, Jan 3, 2011 at 3:24 PM, Kai Koehne <kai.koehne at nokia.com> wrote:
> On 12/29/2010 9:20 AM, ext Gregory Schlomoff wrote:
>> Yes, I was checking those tools, they are great, but we need something
>> that integrates nicely into the build workflow.
>>
>> For example, the best tool to pack QML probably is Douglas Crockford's
>> JSMIN (http://javascript.crockford.com/jsmin.html)
>>
>> JSMIN is very conservative, it really just strips comments and
>> unnecessary whitespace, unlike other tools that attempt more
>> aggressive optimizations that may not be compatible with QML. The
>> source code is one single .c file, available under a permissive
>> license, so if nobody did this before, we are going to use that in our
>> build workflow.
>>
>> But I'd like to suggest to make this feature part of RCC.
>>
>> What do you think ?
>>
>> On Wed, Dec 29, 2010 at 2:54 PM, Abhishek<abhishekworld at gmail.com>  wrote:
>>> Hi,
>>>
>>> On Wed, Dec 29, 2010 at 1:07 PM, Gregory Schlomoff
>>> <gregory.schlomoff at gmail.com>  wrote:
>>>>
>>>> Hi everybody,
>>>>
>>>> I was wondering, has anyone developed a nice tool to pack (a.k.a.
>>>> minify) qml files before they are embedded in the executable?
>>>>
>>>> My concern isn't so much about size, since I'm telling rcc to compress
>>>> them anyway, but just that I don't really want all our comments / doc
>>>> to be embedded in the final executable. So what I'm really looking for
>>>> is a tool that strips comments and un-necessary whitespace out of .qml
>>>> and .js files.
>>>>
>>>>
>>>> Maybe this could be built-in in the rcc tool, or it could be a
>>>> third-party tool that would integrate the build workflow.
>>>>
>>> I dont know about QML is there any tool to do all this but  but you have
>>> tool for
>>> Javascript http://developer.yahoo.com/yui/compressor/ or http://jscompress.com/ (I
>>> haven't checked it with QML js files but yes it works on web )
>>>>
>>>> What do you think?
>
> I don't think such a tool belongs into rcc. You might want to obfuscate
> your files even when not embedding it into the executable. Also,
> debugging won't work with the 'compressed' files, so you want to be able
> to switch it off while developing/debugging.
>
> Why not do the compression once when you do the final build of your app?
>
>
> Regards
>
> Kai
>
>
>>>> Greg
>>>> _______________________________________________
>>>> Qt-qml mailing list
>>>> Qt-qml at qt.nokia.com
>>>> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>>>
>>>
>>>
>>> --
>>> Abhishek Patil
>>> URL: http://thezeroth.net
>>> "Imagination is more important than knowledge..." -Albert Einstein
>>>
>> _______________________________________________
>> Qt-qml mailing list
>> Qt-qml at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>
>
> --
> Kai Koehne
> Software Engineer
> Nokia, Qt Development Frameworks
>
> Nokia gate5 GmbH
> Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
> Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B
> Umsatzsteueridentifikationsnummer: DE 812 845 193
> Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>


More information about the Qt-qml mailing list