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

js-debug vs js-release #1217

Open
sanjeev-rajput opened this issue Dec 21, 2022 · 4 comments
Open

js-debug vs js-release #1217

sanjeev-rajput opened this issue Dec 21, 2022 · 4 comments

Comments

@sanjeev-rajput
Copy link

sanjeev-rajput commented Dec 21, 2022

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
Copy link
Contributor

Harbs commented Dec 21, 2022

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
Copy link
Contributor

Harbs commented Dec 21, 2022

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
Copy link
Author

@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

<title>Learning Module</title>
${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
Copy link
Contributor

Harbs commented Dec 22, 2022

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

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

2 participants