I would think any of these files need to be loaded by some other code.  They 
can't just sit in the output folder.

They may not have to be loaded by inject_html directives.  As I proposed 
earlier in the thread, it might be best to think of this problem in separate 
pieces.  The first piece is to come up with a useful way to annotate code files 
to get other files stored in SWCs into the output folder.  A separate piece may 
be a post-processing step that deals with minification/aggregation of these 
files into fewer files.  The piece that post-processes the files may be 
responsible for modifying the .html file appropriately and could remove 
duplicates.  Or it may be that there is a protocol in the classes where if more 
than one class needs a particular file they must have a dependency on a class 
that carries the annotation to bring in that file so later steps don't have to 
deal with duplicate files.

My 2 cents,
-Alex

On 1/7/20, 12:16 AM, "Harbs" <[email protected]> wrote:

    For js and image/svg files this is probably a complete solution. For CSS, 
there also needs to be code to load the CSS.
    
    I guess a combination of include_file and inject_html might work, but then 
we still have the problem of duplicate <link> injection and combined CSS would 
not be properly referenced.
    
    > For Problem #1, instead of inject_html we could add something like 
"include_file" that would reference a file in a SWC.  Then folks could have 
images, css, js, whatever, added to the output file.  I think that wouldn't be 
too hard to do.  There is already code in the compiler copying stuff out of a 
SWC
    
    > On Jan 7, 2020, at 12:11 AM, Alex Harui <[email protected]> wrote:
    > 
    > 
    > 
    > On 1/6/20, 12:45 PM, "Harbs" <[email protected]> wrote:
    > 
    >    Yes. JS specific.
    > 
    >    It would be very hard to do a SWF compatible build of Spectrum.
    > 
    > So to me, this isn't so much about CSS as it is about externs.  CSS that 
is processed by the compiler is intended for multi-platform CSS.  
Multi-platform CSS is encoded for use by ValuesManager and implementations on 
other platforms.  As Carlos noted in a recent thread, CSS is sort of downloaded 
twice by Royale JS output, once in its .css file form for consumption by the 
browser, and a second time as encoded CSS for use by the framework and 
application code.  That avoids having the framework code call 
getComputedStyles() and allows non-comforming CSS like 
ClassReference("SomeBead").  Although there certainly could be a better way to 
handle this.
    > 
    > On the other hand, the inject_html and externs are about 3rd-party or 
external JS implementations.  There have been other threads about how to handle 
inject_html and have it inject local references to .js files.  Right now I 
think all inject_html use cases reference code on a CDN or some canonical URL 
on the internet.  It feels like this is the same problem and why you started by 
asking about inject_html.  You don't really need the compiler to look at this 
CSS, you really want some amount of css and/or js (and maybe even html) to be 
linked into the output instead of referenced by URL.  Although it sounds like 
you are also looking to aggregate these bits and pieces of external css or js 
into fewer files.
    > 
    > So I recommend approaching the problem in two pieces: 1) what is the best 
way to add js and css to the output files and 2) once you have some set, can 
you aggregate it into fewer files?
    > 
    > Problem #2 sounds straightforward: search the output folder and combine 
files.  I guess it might be important what order you combine CSS files.
    > 
    > For Problem #1, instead of inject_html we could add something like 
"include_file" that would reference a file in a SWC.  Then folks could have 
images, css, js, whatever, added to the output file.  I think that wouldn't be 
too hard to do.  There is already code in the compiler copying stuff out of a 
SWC
    > 
    > My 2 cents,
    > -Alex
    > 
    >> On Jan 6, 2020, at 8:56 PM, Alex Harui <[email protected]> wrote:
    >> 
    >> But is that CSS platform-specific, or will that same CSS be needed if 
you were to try to implement Spectrum in SWF?  IMO, that's a key question for 
how we solve this problem.
    > 
    > 
    > 
    
    

Reply via email to