Exclude files from the Sencha Touch build process

Within my Sencha application, there is a Config.js file that holds various service URLs:

Ext.define('MyApp.utils.Config', {
    singleton : true,

    config : {
        authBaseUrl : '...',
        serviceBaseUrl : '...',
        reportsBaseUrl : '...',
        imagesUrl : '...'
    },    

    constructor : function (config) {
        this.initConfig(config);
    }
});

Prior to deployment, I utilize the

sencha app build

command from the Sencha Touch SDK to compress and combine files.

The issue arises after the build process includes config.js in the minified app.js file. It would be beneficial if I could make edits without having to rebuild or redeploy the entire application. Despite efforts, I have not discovered a way to alter this behavior within the build process.

Therefore, post-building the application, it is preferred to retain these three separate javascript files:

  • sdk/sencha-touch.js (compressed, concatenated, cached locally)
  • app.js (compressed, concatenated, cached locally)

  • config.js (untouched, not cached locally)

Answer №1

Separate it from the application so that it is not bundled, and then add a reference to it in app.json. I have found this approach to be effective in similar situations.

In addition, I maintain a config.js file that undergoes frequent modifications during my development process. In my app.json file, it would appear like this:

"js": [
    {
        "path": "sdk/sencha-touch-all.js"
    },
    {
        "path": "config.js"
    },
    {
        "path": "app.js",
        "bundle": true, 
        "update": "full"
    }
],

This ensures that your config.js file gets included in the build.

Next, you will need to insert the script into your app.html file, ensuring that it loads before your main app.js. Mine appears as follows (generated by Sencha Architect):

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>llm</title>
    <link rel="stylesheet" href="resources/css/llm.css">
    <script src="http://maps.google.com/maps/api/js?sensor=true"></script>
    <script src="sdk/sencha-touch-all.js"></script>
    <script src="config.js"></script>
    <script src="cordova-2.0.0.js"></script>
    <script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>

I hope this solution proves helpful for you!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to implement hover effect to show child div within parent div using React.js

Hey there! I'm fairly new to working with react js and currently trying to add some animation to a nested div. The parent div, known as " portfolio-product-item ", showcases a featured image pulled from the WP REST API. Inside this parent div, there&a ...

Utilizing Redux Reselect for Comment Filtering

Currently, I am attempting to filter and showcase comments that have a matching 'postID' with the current post id. Utilizing Redux/Reselect, the functionality works well but occasionally an error pops up indicating that post._id is undefined/null ...

Tips for accessing and passing the clicked element as "THIS" within an addEventListener

Currently in the process of developing a custom JS library similar to jQuery, I've encountered a stumbling block. I have successfully created an event delegation function intended for a simple click event. While working within this prototype section ...

What are some ways to shift all content (whether relative or absolute) downward?

If I have a webpage containing content positioned relatively and absolutely, along with scripts and various styles applied. Is there a universal method to move down the entire page content by 50px, creating an empty space at the top of the page? The solut ...

Determining Asynchrony in Node.js Through Programming

Is there a way to assess if a function can be executed asynchronously without requiring a callback? I am currently working with Node.js on the Intel Edison platform and utilizing mraa. The native C++ functions like i2c.readReg(address) do not have provisi ...

Why is the implementation of partials not successful in this Angular 14 application?

I am currently tackling a project involving nested form groups in Angular 14. To streamline the process and avoid repetition, I have consolidated common form controls within a partial file. Within my form.component.ts, I have the following setup: import ...

How can I resolve the error message "TypeError: Cannot convert undefined or null to object" when using vue.js rendering?

Everything is functioning properly and I am successfully retrieving the data, but there is a JavaScript error that keeps occurring. The network request in question is as follows: data: { patient: null } methods: { //call meth ...

What is the best way to make this eerie javascript script communicate with my webpage or another jquery file?

I've been struggling with a javascript code that enables infinite scrolling in Tumblr. It seems outdated compared to jQuery, which I'm more familiar with. I've tried integrating this script with my jQuery functions and identifying DOM eleme ...

What is the mechanism behind the clipping function in the three.js frustum?

Currently, I am exploring the frustum feature of three.js by making changes to the example provided in the Scene Graph section here. function main() { const canvas = document.querySelector('#c'); const renderer = new THREE.WebGLRenderer({c ...

Ways to individually select and activate several HTML elements with matching classes, and then apply styles to a different div featuring multiple classes using Jquery or JavaScript

Within my webpage, I have created a section with three links. Clicking on each link reveals specific content (content 1, content 2, and content 3). The issue arises when I have two identical sections (Section 1 and Section 2) and clicking on a link display ...

"Enhance your website's user experience with a sleek multiple selection

I'm attempting to develop a reset button for jquery-select2 multiple select, but for some reason, my solution isn't working as expected. Here is the HTML code: <select id="workload-selector" class="js-source-states-2" multiple="multiple" sty ...

Instructions for transferring information from a JSON column in a MySQL database to an HTML table generated using a PHP foreach loop

I have been working on developing a web application that is connected to a MySQL database all by myself. One of the columns in the database is in JSON format, and I recently implemented it. Here's an example of one row from that column: Column Name: ...

Issues with Alignment of Navbar Elements in Bootstrap 3

When I test my website locally, the elements are aligned correctly as expected. However, when I view it on my live webpage, the elements are all left-aligned. I've attempted a solution from this source, but the issue persists. What confuses me is why ...

Please tap to dial: Access to navigation is restricted

Trying to add a click-to-call link with the following code: <a href="tel:+4912345678912">Tel: +4912345678912</a> Despite Google developers saying it should work, major mobile browsers are blocking the navigation when clicking on the link. It ...

The ready/load frame event fails to trigger when a new frame URL is loaded

I currently have a website that uses frames, allowing users to change the content of a frame with a simple link that loads the new page in that frame. My goal is to determine when this loading process is complete. $(top.frames['mainFrame'][&a ...

Incorporating external script into React website's functional component

I have invested countless hours on this particular issue, which appears to be quite trivial, yet I am unable to pinpoint where my mistake lies. I recently purchased terms and conditions from Termly.com and now wish to showcase these terms and conditions o ...

What is the process for creating a customized object using Serialized format?

In order to convert a few serialized form elements into a JSON object, I created a function. However, when the fieldName is included in the JSON object, it appears as "fieldName" instead of the actual field name such as "PositionId" or "Series". Although ...

"Having trouble with ion-input functionality, but regular input is functioning without

Here is a code snippet that allows for multiple inputs in a list: <ion-content> <ion-list> <ion-item ng-repeat="player in players"> <ion-label>Player {{$index+1}}</ion-label> <input type="text" ng-mod ...

Using the ng-template-outlet within two separate loops

I am facing an issue where I need to repeat the same code in two different places. The profiles, profile1 and profile2 are arrays. I want to display the same HTML code without duplicating it. profile1 = [{name : 'mr.A1',age : 25 }, {name : &apos ...

Guide on catching network errors using Axios request interceptor?

After encountering issues with our Vue application, I observed in the Sentry logs that the problem may stem from an unreliable network: Error: Network Error Error: Request aborted I wanted to display a warning message to the user but couldn't find a ...