Create www folder in ionic react app for publish - ionic-framework

I am trying to publish ionic app to www folder,I want create www folder with index.html and css,js folders...
npm run ionic:build
this command create build folder not www(but not problem I can change build folder name to www) folder.And in build folder there is index.html but when I click it,it is blank page not my react page
How can I create www folder in ionic app?A www folder which include working index.html page,js and css folders

You can basically move the default folder to www folder after the build command is finished, so you want to edit the package.json and do something like this:
...
"scripts": {
"ionic:build": "ionic-app-scripts build && mv build www",
"ionic:serve": "ionic-app-scripts serve"
},
...
I also found that you need to have permissions to move the folder, so run your code editor as admin. After that, you can't just click the index.html, the folder needs to be deployed or you may serve it with a static server.

Related

How to exclude other package.json from VSCode npm script scan

In VSCode, the "NPM SCRIPTS" panel shows the root package.json scripts as expected and desired, however it also shows scripts from a package.json in a hidden .cache folder.
Other SO answers advise editing VSCode's settings.json to control this area, using:
`"npm.exclude": "**/#(|vendor|node_modules|bower_components|dist|static)/**",`
However adding |.cache to this exclude line does nothing; the .cache package.json scripts are still displayed.
Put another way, how can I just see the root package.json NPM scripts in VSCode's "NPM SCRIPTS" panel?

my package.json file of react application shows different in file and different in vs-code

I installed gh-pages for my react project and ran into an error. I've shared an image which will make it clear. Due to that reason I can't save my package.json file.

why ionic www folder is showing blank content

I'm new to ionic framework and I want to deploy my app to my website and I put 'www' folder into my website but it only shows blank page .
Try running below command in the root directory,
ionic build
It will compile the project and create www folder for you.

Ionic 4 create project in a directory

I have a folder name hybridapp inside Projects folder. I want to create a new Ionic project inside the folder hybridapp and don't want Ionic to create any new root project folder.
Right now, ionic start . is interpreted as "create a project named .".
$ mkdir project; cd project
$ ionic start .
Please name your Ionic project something meaningful other than '.'
I found one way to create new Ionic4 project in a specific way as follows:
Move out of your the project folder i.e. in my case hybridapp.
Then create a new Ionic project using Ionic start but give the App name same as your project folder app i.e. hybridapp in my case.
ionic start hybridapp
Now when we move inside the project folder we can see all the Ionic files generated by Ionic.

Ionic serve command resets the index.html page

I've recently started developing in Ionic, and I find that once I've made changes to the index.html file and run it (ionic serve), it resets the index.html file.
I think I might be missing a step somewhere, any ideas?
Found the error. I was editing the file in the www folder and not the one in the src folder. Once I updated the index.html file in the src folder, the changes appear in the file in the www folder.
However, I find that when I update the controllers in the src/js folder, they are not updated in the www/js folder, so I have to make updates to the files in the www/js folder.
Not really sure of what's going on.
src folder is true development folder.
When ionic builds the app for you it automatically copies all the required files from src/ to www/.
If its not happening there might be something wrong with project, try removing and adding platform again.