user6579134
user6579134

Reputation: 839

ionic cordova run override changes in style sheet and config.xml

i migrated from ionic 1 and just started building ionic2 apps, what i've noticed is when i'm testing on the phone and i run ionic cordova run android from the command prompt, it makes changes to the index.html by clearing my custom.css file and also changes i've made in the config.xml gets back to its default state loosing all changes

For example before running the command my file looks like this

<link href="build/main.css" rel="stylesheet">
<link href="build/custom.css" rel="stylesheet">

after i run the cli command and it starts running my script changes to

<link href="build/main.css" rel="stylesheet">

removing the custom.css from the build which affect the app

Upvotes: 0

Views: 860

Answers (2)

Vince Banzon
Vince Banzon

Reputation: 1489

You might be coding on www folder. In ionic 2, you should code on src folder. You can't make any changes to www folder since it will be overridden by src folder once it is transpiled.

Due to high level programming that ionic2 uses, ES6, they need to transpile the code to ES5, which browsers can read (browsers can't read ES6 yet and ES6 is just an update of EC5).

That's why we should code to the src folder, and ionic will transpile the code readable to browsers, overriding all codes at www folder.

Upvotes: 1

Floydus
Floydus

Reputation: 81

I had this issue just now, turned out two terminals were open. ionic serve console was reverting the config.xml upon any change. Closed that terminal, now my built reflects the files.

Upvotes: 1

Related Questions