apache / royale-asjs

Apache Royale ASJS
Apache License 2.0
371 stars 116 forks source link

js-debug vs js-release #1217

Open sanjeev-rajput opened 1 year ago

sanjeev-rajput commented 1 year ago

1. CSS file Build works with "js-debug" but in "js-release" compiler change file name Main.css to Main.min.css but entry of css file doesn't reflects in "index.html"

either css file name should not be change or correct new file name must be added in index.html

2. Reading JSON file

in "js-debug"

_data is a JSON object

for each(var i:Object in _data){ trace(i.topic); } this works perfectly fine in "js-debug" but doesn't works in "js-release" it has to be change as below

for each(var i:Object in _data){ trace(i['topic']); }

"js-debug" approach is standard one i think "js-release" must follow the same

Harbs commented 1 year ago

Regarding your first point: What does your template html file look like? Make sure you have the ${head} token. Your minified css file should be correctly linked.

Regarding your second point, please read this page: https://apache.github.io/royale-docs/create-an-application/optimizations/minification

Harbs commented 1 year ago

Actually, here's what I have in my template file: <link rel="stylesheet" type="text/css" href="${application}.css?{build_number}">

${application}.css becomes MyApp.css in debug and MyApp.min.css in release. I have a build script which appends the build number for cache-busting.

sanjeev-rajput commented 1 year ago

@Harbs - it does works

the main confusion is - you won't find "Main.min.css" in debug mode but it appears in "js-release"

this is what my index-template.html <!DOCTYPE html>

Learning Module ${head} ${body}

asconfig.json { "config": "royale", "compilerOptions": { "debug": true, "targets": ["JSRoyale"], "source-map": true, "html-template": "src/assets/config/resources/index-template.html", "theme": "${royalelib}/themes/JewelTheme/src/main/resources/defaults.css" }, "copySourcePathAssets": true, "additionalOptions": "-remove-circulars -js-output-optimization=skipAsCoercions", "files": [ "src/Main.mxml" ] }

Harbs commented 1 year ago

It does probably make sense to not add the min. to the name for release. It doesn't really add anything.