Skip to content
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

Reduce compiled TSS file size #1321

Open
macCesar opened this issue Mar 24, 2022 · 0 comments
Open

Reduce compiled TSS file size #1321

macCesar opened this issue Mar 24, 2022 · 0 comments

Comments

@macCesar
Copy link
Contributor

macCesar commented Mar 24, 2022

I'm readdressing this issue that was originally brought up in Michael's JIRA Ticket .

Problem:
Currently, an app.tss file is compiled into every /android/alloy/styles/ and /iphone/alloy/styles style, needlessly increasing file sizes and causing redundancy.

Example:
For instance, if you have a very large app.tss file (1MB) and five controllers with no styles defined, you'll end up with five separate 1MB files (totaling 5MB) instead of one 1MB file and five empty files (totaling 1MB).

Idea:
Controllers already use the require function to include Alloy or other controllers. Why not create an /Resources/android/alloy/styles/app.js file and include that file in the other compiled style files while merging it with their styles?

Michael also posted the following comment on the matter:
“Michael Gangolf 2020-11-20 I've already tried to edit https://github.com/appcelerator/alloy/blob/1b9fd4685f0a6abebe1620b021c1d360523f9e8b/Alloy/commands/compile/index.js#L673 and I'm able to write a appTss.js file. I just have trouble including it in the other style files. Tried it with require but it doesn't seem to work here”

Now, here are my thoughts on this:
I'm not very familiar with Alloy's/Titanium's compilation process, but if index.js is indeed the primary styles file that includes a module.exports, why don't all other style files simply require it? This could substantially reduce redundant code.

Additionally, if a particular style file has its unique set of classes, these classes could potentially be merged together. Is this a feasible approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant