-
-
Notifications
You must be signed in to change notification settings - Fork 897
Description
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?