Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Intermittent: CSS file not updated on rebuild, or inaccessible from local html file

I'm working with Developer 1.0, mobile SDK 1.1, iPhone SDK 3.1.2.

I'm having some problems with Emulator Building that I suspect are related to the new incremental build process in 1.1.

(1) Intermittent CSS file inaccessibility:

A local CSS file appears intermittently inaccessible from a local html file.

My webview is populated with a local html file at Resources/subdirectory/myhtmlfile.html.

Inside is a link to a stylesheet in /Resources: link rel="stylesheet" type="text/css" href="../mainstyle.css".

Sometimes (still can't figure out the pattern), when I build my app and then navigate to the webview, the html is unstyled. The console reports no relevant error that I can see. Subsequent rebuilds (Stop/Launch) don't fix the problem. All html files pointing to that css file are unstyled.

(2) CSS File Not Updating on Rebuild

Sometimes when I edit an existing css file, and run my app in the emulator, my changes are not reflected. The old css styles display instead.

(3) Solutions

In both cases, running the app on device (iPhone) results in app functioning as expected (css file is connected and edits are reflected).

The following fixes the problem in the emulator:

  1. Edit project, change Titanium SDK to 1.0.0, Save
  2. Launch in emulator (css displays properly)
  3. Change Titanium SDK back to 1.1.0 (css still displays properly)

Basically the effect of the process is to force a complete rebuild instead of incremental change.

I'm still trying to nail down a situation that reliably replicates the issue. So far it seems more or less random (though rather frequent). Has anyone else experienced this? Is there an easier way to force a complete rebuild?


— asked March 24th 2010 by Nick Haffie-Emslie
  • css
  • emulator
  • iphone
  • webview

1 Answer

  • I was having trouble getting a .css file to copy to the simulator in 1.0.0, so I changed the extension to .txt and it's worked fine for me since.

    — answered March 24th 2010 by Mark Burggraf
    1 Comment
    • Weirdly enough this works a treat. Thanks!

      — commented November 10th 2010 by Matt Collinge
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.