Problems with adding multiple html files on Mosync - javascript

i'm new to Mosync and i'm trying to create an HTML5/Javascript project. The IDE generates a main.cpp file and an index.html file.
The main.cpp file contains a reference for the index.html file; i've already tried creating a new html file inside the same folder where the generated index.html file is and changed the reference in the main.cpp file to call the file that i've just created but it gives me an error that says the file cannot be found.
I've even tried removing all the code in the generate index.html file and running it and the results still shows all the deleted code from the index.html file.
My question would be how do i add multiple html files when creating a MoSync project?

It should work to do what you are doing, this could be a bug. Can you provide some details about which version of MoSync you are using, and which platform?
You should be able to have any html file in the folder LocalFiles in a MoSync project, and then just pass the file name to showPage in main.cpp, just as you are doing.
Perhaps the project is not rebuild properly? Try to right-click on the project in Eclipse, then select Rebuild. Are you on iOS or Android? How do you transfer the app to the device?

As Mikael mentioned also, I think it is an IDE bug, I tried refreshing/rebuilding the project and it worked fine. Sometimes eclipse does not detect file changes that come from other editors so it ignores them.

Related

PhoneGap build is not updating all of my files

PhoneGap build is not updating all of my files? I have been using Build for a while, but now the downloaded application seems like not contains the css file.
I tried to delete the application then upload new zip file and rebuild it but same issue appear.
I renamed the file extension .apk to .zip and i opened the file I recognize that the css folder is not in the same root as other folder like .js and i think it is the problem, but i don't why this happened.
Any help??
I fixed the issue by deleting the css folder then rebuild the app and it is working now

Using gulp correctly showing the js file in the console [duplicate]

Recently I have seen files with the .js.map extension shipped with some JavaScript libraries (like Angular), and that just raised a few questions in my head:
What is it for? Why do the guys at Angular care to deliver a .js.map file?
How can I (as a JavaScript developer) use the angular.min.js.map file?
Should I care about creating .js.map files for my JavaScript applications?
How does it get created? I took a look at angular.min.js.map and it was filled with strange-formatted strings, so I assume it's not created manually.
The .map files are for JavaScript and CSS (and now TypeScript too) files that have been minified. They are called source maps. When you minify a file, like the angular.js file, it takes thousands of lines of pretty code and turns it into only a few lines of ugly code. Hopefully, when you are shipping your code to production, you are using the minified code instead of the full, unminified version. When your app is in production, and has an error, the source map will help take your ugly file, and will allow you to see the original version of the code. If you didn't have the source map, then any error would seem cryptic at best.
Same for CSS files. Once you take a Sass or Less file and compile it to CSS, it looks nothing like its original form. If you enable sourcemaps, then you can see the original state of the file, instead of the modified state.
So, to answer you questions in order:
What is it for? To de-reference uglified code
How can a developer use it? You use it for debugging a production app. In development mode you can use the full version of Angular. In production, you would use the minified version.
Should I care about creating a js.map file? If you care about being able to debug production code easier, then yes, you should do it.
How does it get created? It is created at build time. There are build tools that can build your .map file for you as it does other files. Sourcemaps fail if the output file is not located in the project root directory #71
I hope this makes sense.
How can a developer use it?
Don't link your js.map file in your index.html file (no need for that)
Minification tools (good ones) add a comment to your .min.js file:
//# sourceMappingURL=yourFileName.min.js.map
which will connect your .map file.
When the min.js and js.map files are ready...
Chrome: Open dev-tools, navigate to Sources tab. You will see the sources folder, where un-minified applications files are kept.
I just wanted to focus on the last part of the question; How are source map files created? by listing the build tools I know that can create source maps.
Grunt: using plugin grunt-contrib-uglify
Gulp: using plugin gulp-uglify
Google closure: using parameter --create_source_map
The map file maps the unminified file to the minified file. If you make changes in the unminified file, the changes will be automatically reflected to the minified version of the file.
Just to add to how to use map files: I use Google Chrome for Ubuntu and if I go to sources and click on a file, if there is a map file a message comes up telling me that I can view the original file and how to do it.
For the Angular files that I worked with today I click Ctrl + P and a list of original files comes up in a small window.
I can then browse through the list to view the file that I would like to inspect and check where the issue might be.

Cordova saving a file within the www folder

I am currently creating a Cordova app to save files and read files. I ahve successfully managed to code it up so that it reads a file from the device (or creates it if it does not exist) and then write to that file.
The problem I am having is that it is saving the file to the root of the device. I added in a getDirectory method to create a new directory under the root where the file can sit and this is working but ideally I would like to save the file within the www folder of my Cordova app. Is this possible? Also is there any way of making sure the user is unable to write to this file?
The www folder is in readonly mode. You can't write anything in it.
Cordova plugin file documentation explain this.

Cordova: How to change HTML source directory?

I am trying to use Cordova 3.4 in conjunction with AngularJS. I followed this tutorial and at some point it asks me to alter html.source.dir and html.asset.dir in ant.properties file. However, I am not being able to find this file anywhere in my source directory.
How do I change html source directory in Cordova?
Regards,
JadeSync.
turns out ant.properties do not come bundled with new versions of Cordova. I had to alter Gruntfile.js to change these directories.

Phonegap Android HTML wont update

I am trying to upload some code html and javascript code into phonegap to develop this app however when I update the files the program still runs the old code as to what was in the html file before. I have even started a new project and it will not change the old index.html image even though the code behind it is different. I'm really confused as to why this is and I was wondering what I could do to solve this. I even searched through the workspace index.html file and it is the correct file that I want in there but upon running it i am given the same your device is ready hello world. I checked the location of the files and everything is correct. It is very confusing. I am using eclipse by the way not phonegap build if that helps.
you need to build your project again.
cordova build android
But make sure you edit your files in www folder in parent folder.
Make sure you are updating the WWW file in the root Phonegap folder. Then you can run the command:
$ cordova build
or
$ phonegap build

Categories

Resources