Sencha touch 2 SDK compress JS file - compression

there is a way to specify in app.json, where I include js files, not to minify 1 js file, somethig like
"js": [
{
"path": "sdk/sencha-touch.js"
},
{
"path": "sdk/myjs.js",
"compress": false
},
...
"compress": false -- ofc doesn work , there is something to specify not to compress or minify that js file ?
Thanks for any help!

As fas as I found there is not why to specify not to compress, the way how I do an workaround is:
creating in "resources" folder a "js" folder and dropped my js file in that folder
Updated the app.json file (not to loose the "js" folder when we build production app) like this :
"resources": [
"resources/js",
]
Include the file in index html as a regular script

Related

karma config fails to add external project or file in the current project

I have added unit tests in some frontend projects using karma. I have multiple projects in my Git folder. If I run them individually, they work fine. However if there is a dependency of one project in another project it fails to include it. (failed to load JavaScript resource:)
If I run the tests using the html file directly, it runs the tests normally and even loads the external projects without any error. following are my resource roots in my unitTest.qunit.html file:
data-sap-ui-resourceroots='{
"x.y.projectmain": "../../",
"test.unit": "./",
"x.y.project2": "../../../../project2/WebContent"
}'
If I try to include the project same way in my Karma.conf.js it gives an error:
"Failed to resolve dependencies of 'x/y/projectmain/test/unit/AllTests.js' -> 'x/y/projectmain/test/unit/myUnitTest.js' -> 'x.y.project2/util/myfile.js': failed to load 'x.y.project2/util/myfile.js' from ./../../project2/WebContent/util/myfile.js: script load error"
Following are some of my Karma.conf.js settings:
ui5: {
type: "library",
paths: {
src: "projectmain/WebContent",
test: "projectmain/WebContent/test"
},
url: "https://openui5.hana.ondemand.com",
mode: "script",
config: {
async: true,
bindingSyntax: "complex",
compatVersion: "edge",
resourceRoots: {
"x.y.projectmain": "./base/projectmain/WebContent",
// "x.y.project2": path.resolve('../project2/WebContent')
"x.y.project2": "./../../projet2/WebContent"
// "x.y.project2": "./base/projectmain/WebContent/test/resources/project2/WebContent"
// "x.y.project2.util": "./base/project2/WebContent/util"
}
}
,
tests: [
"x.y.projectmain/test/unit/AllTests"
]
},
files: [
'Utils.js',
{ pattern: "../public/Project2/WebContent/utils/myfile.js", included: false, served: true, watched: false, nocache: true },
{ pattern: '../Project2/WebContent/**/*', watched: true, served: true, included: false }
],
// proxies: {
// '/project2/': path.resolve('../../project2/WebContent')
// },
proxies: {
'/x.y.project2/': '/absolute/' + path.resolve('../project2/WebContent'),
'/myfile.js/': '../public/project2/WebContent/util/myfile.js'
},
I have tried many things here. It even refers to the exact file in that external project but it just cant load the file. If I try to load the file manually in the browser it opens fine. But with Karma it gives an error.
My ultimate goal is to add one project as a dependency inside another project. I did check it by copying the whole WebContent folder from Project 2 inside the 'ProjectMain/WebContent/test/Resources/' directory It does work, but that's not appropriate way to include it.
There must be some way where we can register or include one project in another either as a resource root or proxies.

How to insert file into FormData Object Array on Postman?

I need to upload files with users documents information just like so:
{
"documents": [
"documentType": "string",
"file": "byte[]",
],
"requestId": "string",
}
how do i do this on Postman?
i've tried many ways, such as:
also changing to just "file" + file, and "documents[0]" + file, and "documents[0][file]".
Use documents.file instead of documents[file] to access the content. For example:
Postman Key-Values Screenshot

how to configure angular to work remotely with django APIs?

I am running a web application, front-end with angular and back-end with django. the thing is: These two frameworks are not running on the same server. how can I configure angular to work remotely with APIs? (I have tested the APIs, and they are just fine)
Check setup proxy for your project from Proxying to a backend server
Basically you need to create a proxy.conf.json file and have settings like:
{
"/api": {
"target": "http://localhost:3000",
"secure": false
}
}
Then you can define your backend hostname, port and available APIs and other settings.
OK, after hours of debugging I finally found it.
FIRST Create a file named proxy.conf.json in /src folder and fill it with this json:
{
"/api": {
"target": "http://test.com/",
"secure": false,
"changeOrigin": true,
"logLevel": "info"
}
}
This line is ESSENTIAL:
"changeOrigin": true,
THEN Edit the angular.json file.In the projects section, find architect and append this line to optionssection:"proxyConfig":"src/proxy.conf.json". So it should look like this:
.
.
.
"options": {
"browserTarget": "some-name:build",
"proxyConfig": "src/proxy.conf.json"
},
.
.
.
NOTE1 Trailing comma is not allowed in JSON.
NOTE2 Loglevel gives you more information.
NOTE3 Thanks to Haifeng for his guide.

manifest.json:2 Manifest: Line: 2, column: 2, Unexpected token

Good day.
I have tried to add a manifest file to my SharePoint site with no success.
Please keep in mind that this is my first attempt at adding a manifest file.
So i created a manifest.jason file containing the following code:
{
"name": "",
"short_name": "",
"icons": [
{
"src": "SiteAssets/smallBlock.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "SiteAssets/bigBlock.png",
"type": "image/png",
"sizes": "512x512"
}
],
"theme_color": "#790B0B"
"background_color": "#790B0B",
"display": "standalone",
}
I have also included in my masterpage like so :
<link rel="manifest" href="/Style%20Library/scripts/manifest.json">
...This does not work
The error i get when working with the chrome dev tools is the following:
manifest.json:2 Manifest: Line: 2, column: 2, Unexpected token.
Please can someone assist.
In my previous removed reply I said I had a feeling that Sharepoint doesn't like requesting JSON files from site folders, I was right. Look at the response of the manifest call, it gives you a strange js/html file. Instead of using manifest.json, use manifest.webmanifest, like so:
href="/Style%20Library/scripts/manifest.webmanifest"
This completely resolved it for me, I hope it does for you as well.

How to handle static files handler in Tornado with several static folders?

My current routing tables is like below:
routing_table = [
("/api/ping", PingHandler),
("/css/(.*)", StaticFileHandler, {
"path": "my-website-path/css"
}),
("/js/(.*)", StaticFileHandler, {
"path": "my-website-path/js"
}),
("/fonts/(.*)", StaticFileHandler, {
"path": "my-website-path/fonts"
})
I would like to use only one regex to handle my static files.
Something like below ?
routing_table = [
("/api/ping", PingHandler),
("/(css|js|fonts)/(.*)", StaticFileHandler, {
"path": "my-website-path/$1"
})
How can I do that?
Thank you in advance.
A RequestHandler pass all matches as a positional arguments to the http-verb function. Since the StaticFileHandler extends it and you have 2 captured groups, your code won't work as expected. So the regex needs to be changed, step by step:
match entire path: /(.*)
first part should be fonts, js or css: ((jss|css|fonts)/.*
the inner group should not be captured - make use of ?:: ((?:jss|css|fonts)/.*
The code
routing_table = [
("/api/ping", PingHandler),
("/((?:css|js|fonts)/.*)", StaticFileHandler, {
"path": "my-website-path"
}
Keep in mind, that the StaitcFileHandler (as #cricket_007 mentioned)...
This handler is intended primarily for use in development and light-duty file serving; for heavy traffic it will be more efficient to use a dedicated static file server (such as nginx or Apache). We support the HTTP Accept-Ranges mechanism to return partial content (because some browsers require this functionality to be present to seek in HTML5 audio or video).