qooxdoo-archive / qooxdoo-cli

(deprecated, moved into qooxdoo-compiler) qx commandline
MIT License
4 stars 5 forks source link

qx compile must run twice for mobile apps #44

Closed hkollmann closed 6 years ago

hkollmann commented 6 years ago

In the current version compile must run twice to get the compiled scss files into the resources in the output:

  1. run: The scss file in source/theme is compiled to an css file in source/resources. This is the behavior in generate.py.
  2. run: The css file in source/resources is build into the resources and copied over to the output dir.

With this issue i would discuss possible solutions:

  1. run maker.make twice pros: Simple to implement, no need to change qooxdoo-compiler cons: Looks ugly, second run is only necessary under special circumstances

  2. Change Manager in qooxdoo-compiler to add an second task if the handler requieres this.

  3. Do not compile the sass file to the resource dir. Instead compile it directly to the output dir. I have no idea how to handle the resources in this case.

What do you think? Any better ideas? Hints?

Best regards, Henne

johnspackman commented 6 years ago

IMHO Option 3 is the way to go - the resource manager does not have the concept of multiple targets or even build process, i.e. it just copies from source to "a" destination in a single pass - neither does the maker when it comes to classes, it simply expects that classes are transpiled (also in a single pass) directly into the output directory.

For classes this is essential because the target can apply different rules and generate different transpiled classes - for example, removing dead code due to if (qx.core.Environment("qx.debug")) { ... }, so re-making for each target is not duplication of work which could be optimised away.

Image and font resources are much less likely to need to be processed differently between targets, which is why they are focused on just copying from source; but this is a bug really because with scss it is possible to also have different outputs for build target vs source target (I've only just looked at this but by way of an example, scss supports add/strip line number comments, there is the debug_info option for firebug, and command line variables could adjust the compile - see https://stackoverflow.com/a/21454098/2979698).

As the output can change on a per-target basis, option 3 will have to apply, and the resource manager will have to know about the current target.

This change in focus would affect images also when we implement combining/splitting (see https://github.com/qooxdoo/qooxdoo-compiler/issues/25); previously, generate.py would process image resources in the source directory, which means that the generated files would normally go into your VCS - not ideal, but probably not enough of a problem to worry about.

At some point we may decide that it is appropriate to create a cache directory that can be common across targets (eg because it is unlikely that the combined images will be different for each target), but that should a separate subject

hkollmann commented 6 years ago

I agree with you. But then it's an task for qooxdoo-compiler. Is it possible to move issues?

johnspackman commented 6 years ago

no, there is a website and a chrome extension that use the API to copy them, but I don't fancy giving API logins to a random website :( I think we just create it as an issue in compiler, reference this one, and close this