Run Code
Run your code directly from SrcNexus Code Editor or configure a custom preview URL.
Running Simple HTML/CSS/JS Files
If your project contains simple HTML, CSS, and JavaScript files, you can directly click the ▶️ Run button to execute and preview your code instantly. SrcNexus Code Editor will run your HTML file in the preview panel without any additional configuration.
How SrcNexus Code Editor Selects Which File to Run
SrcNexus Code Editor automatically determines which HTML file to run based on the currently open file:
If an HTML file is currently open:
- SrcNexus Code Editor will run the currently open HTML file in the preview panel.
If a non-HTML file is currently open:
SrcNexus Code Editor follows this logic to find the HTML file to run:
-
Check the current file's folder:
- If there is only one HTML file in that folder, it will run that file.
- If there are multiple HTML files in that folder, it will run
index.htmlfrom that folder. - If
index.htmlis not present in that folder, SrcNexus Code Editor will check the project root.
-
Check the project root:
- If there is only one HTML file in the project root, it will run that file.
- If there are multiple HTML files in the project root and
index.htmlexists, it will runindex.html. - If
index.htmldoesn't exist in the project root or there are no HTML files in the project root, no file will run.
Configuring the Run Button
You can configure the Run button to work according to your preferences. One of the options is to set a Preview URL that opens instead of running the local HTML file.
Preview URL
Setting Up Preview URL
- Open your project
- Tap the ⋮ (three dots) menu in the top-right corner
- Select Preview URL
- Enter your custom URL
The next time you hit ▶️ Run, SrcNexus Code Editor will open that URL instead of executing the local HTML file.
Preview URL Options
You can customize how and when the Preview URL is used:
- Choose to use your Preview URL only when no HTML file is present, or every time you tap Run
- Enable or disable the Preview URL at any time from the popup
Redirect on Run
If you want to set up redirects when running your code, you can use redirect rules. See the Redirect Rules section for more information on configuring redirects.