Problems Getting External CSS files to work with ExtJS 6 - extjs

I've created my app the normal way with cmd in ext 5 and what I had done was simply put my css files (in the index.html file) and when I would run sencha app build my styles word override the ones in ext (that is things like the body tag).
Now, I've recreated my ext project with cmd again from scratch, copied in my app.js and app folder and it works but it seems that my app flashes my body tag but then it goes away and the standard css takes over.
That is, in my in my index.html I have the lines:
<link href="/Content/Styles/scrum-style.css" rel="stylesheet" type="text/css"/>
<link href="/Content/Styles/SessionSchedule.css" rel="stylesheet" type="text/css"/>
***Added Note:
After reading, I've copied the css from the two files into /sass/etc/all.scss and that pushed the css into the top of the generated file but it still seems to be overridden.
(also posted to sencha forums yesterday but got no response so trying here)

You could try adding them to app.json:
"css": [
{ "path": "Content/Styles/scrum-style.css" },
{ "path": "Content/Styles/SessionSchedule.css" },
{
// this entry uses an ant variable that is the calculated
// value of the generated output css file for the app,
// defined in .sencha/app/defaults.properties
"path": "${build.out.css.path}",
"bundle": true,
"exclude": ["fashion"]
}
],
Or you could load them remotely:
"css": [
{ "path": "Content/Styles/scrum-style.css", "remote": true },
{ "path": "Content/Styles/SessionSchedule.css", "remote": true },
{
// this entry uses an ant variable that is the calculated
// value of the generated output css file for the app,
// defined in .sencha/app/defaults.properties
"path": "${build.out.css.path}",
"bundle": true,
"exclude": ["fashion"]
}
],
But add them to "resources": [] as well to copy them on build.

There are 2 ways to include external CSS files in your application.
You can add references in index.html file. In this case after build you need to manual copy CSS files in build application resources folder.
You can add reference in app.json file in css array and build app. In this case if you do change in css file , you need to build app.

Related

ExtJS Package Classic Resources Missing

I have an ExtJS package with the following structure:
Package
classic
resrouces
file.json
When I build the app with the package in production mode, the file.json is missing.
How can I get the build to include the resources from classic directory (within a package)?
EDIT
Adding the following to package.json enables copying files from both toolkit specific and shared resources directory.
"resource": {
"paths": [
"${package.dir}/resources",
"${package.dir}/${toolkit.name}/resources"
]
},
However, all the files (from classic/resources/ and resources/) are copied to the same directory (build/production/AppName/classic/resources/PackageName/) and if same filename exists in both directories, one file overwrites the other in the build directory.
build/production/AppName/classic/resources/PackageName/some_resource_file.json
How can they be separated so both files exists in the build?
In your main project folder, you have the file app.json, where you can define which directories should be copied when building the project and a rule for skipping some of them:
{
"production": {
"output": {
"resources": "resources",
// ...
},
},
"resources": [{
"path": "resources", // in your case classic/resources
"output": "shared"
}],
/**
* File / directory name pattern to ignore when copying to the builds. Must be a
* valid regular expression.
*/
"ignore": [
"(^|/)CVS(/?$|/.*?$)"
]
}

Bootstrap material fullpalette

I would like to add the fullpalette of bootstrap material design in my Angular application.
When I'm doing "grunt build" this file material-fullpalette.min.css isn't working in the dist (I added it manually in my index.html).
How can I do it correctly so that I'll be able to use all the colors of the css file?
For adding the material-fullpalette.min.css, you need to do make change in the following file
Location: bower_components\bootstrap-material-design\bower.json
For adding only material-fullpalette.min.css, just do following change
"main": [
"dist/css/material.css",
"dist/js/material.js",
"dist/css/ripples.css",
"dist/js/ripples.js",
"dist/css/material-fullpalette.css"
],
For adding other files, you need to do following
"main": [
"dist/css/material.css",
"dist/js/material.js",
"dist/css/ripples.css",
"dist/js/ripples.js",
"dist/css/material-fullpalette.css",
"dist/css/roboto.css",
"dist/fonts/Material-Design-Icons.eot",
"dist/fonts/Material-Design-Icons.svg",
"dist/fonts/Material-Design-Icons.ttf",
"dist/fonts/Material-Design-Icons.woff",
"dist/fonts/RobotoDraftBold.woff",
"dist/fonts/RobotoDraftBold.woff2",
"dist/fonts/RobotoDraftItalic.woff",
"dist/fonts/RobotoDraftItalic.woff2",
"dist/fonts/RobotoDraftRegular.woff",
"dist/fonts/RobotoDraftRegular.woff2"
],
Then if you run grunt, it will be automatically included in the main package.

Ext JS Code Package: Include resources/css/*.css in package build

I have a CSS file in the resources/css directory of my Ext JS package. Nevertheless package-all.css is empty after the sencha package build.
How can I make Sencha put the CSS file's contents into package-all.css? It should finally be copied to the all.css file of the app that uses the package.
You have to add it to package.json as a resource.
/**
* Extra resources to be copied along when build
*/
"resources": [
"resources/css/app.css",
"resources/images",
"resources/static",
"resources/libs",
"resources/translations"
],
or even better as a css file.
/**
* List of all CSS assets in the right inclusion order.
* Each item is an object with the following format:
* {
* "path": "path/to/item.css" // Path to file, if local file it must be relative to this app.json file
* "remote": true // (Optional)
* // - Defaults to undefined (falsey) to signal a local file which will be copied
* // - Specify true if this file is a remote file which will not to be copied
* "update": "delta" // (Optional)
* // - If not specified, this file will only be loaded once, and
* // cached inside localStorage until this value is changed to either one below
* // - "delta" to enable over-the-air delta update for this file
* // - "full" means full update will be made when this file changes
*
* }
*/
"css": [
{
"path": "resources/libs/Arcgis v3.11/arcgis311.css",
"remote": true
},
{
"path": "resources/css/app.css",
"remote": true
}
]
You can include it directly to index.html. Its working fine in build as well.`
<title>xxxxx</title>
<!-- The line below must be kept intact for Sencha Cmd to build your application -->
<link type='text/css' rel='stylesheet' href='resources/custom/css/my_css.css' />
<link type='text/css' rel='stylesheet' href='resources/fonts/font-awesome-4.3.0/css/font-awesome.css' />
<script id="microloader" type="text/javascript" src="bootstrap.js"></script>
`
Inspired by Tarabass' answer, I added my CSS file in package.json inside the package. Now it is used by the app.
"css": [{
path: "resources/css/styles.css"
}],

ui-grid symbols issue

I am using AngularJs ui-grid http://ui-grid.info/.
While implementing, I get something which you can see in the following img in right corner of the cell instead of dropdown symbols.
Which files to include to solve this bug?
You need to download the font files:
ui-grid.woff
ui-grid.eot
ui-grid.svg
ui-grid.ttf
from here. And move them where your ui-grid.min.css lives.
Please include ui-grid CSS file by this way
<link rel="stylesheet" href="/release/ui-grid-unstable.css">
and ommit the script tag from the Authors Tutorial or Api
<script src="/release/ui-grid-unstable.css"></script>
for eg (http://ui-grid.info/docs/#/tutorial/102_sorting)
I would just like to add this answer (stolen verbatim from panciz) for the folks using Grunt who would like to have these automatically copied. This needs to be placed in your Gruntfile.js:
copy: {
dist: {
files: [
...
//font di ui grid
{
expand: true,
flatten: true,
dest: 'dist/styles/',
src: ['bower_components/angular-ui-grid/ui-grid.ttf',
'bower_components/angular-ui-grid/ui-grid.woff',
'bower_components/angular-ui-grid/ui-grid.eot',
'bower_components/angular-ui-grid/ui-grid.svg'
]
}
]},
You may also want to look at a recently added tutorial: http://ui-grid.info/docs/#/tutorial/116_fonts_and_installation
This covers how to install the fonts correctly, and a little bit of trouble shooting.
Another way to solve the issue is modify the CSS class as follows
.ui-grid-icon-down-dir:before {
content: '\25bc';
}
.ui-grid-icon-up-dir:before {
content: '\25b2';
}
.ui-grid-selection-row-header-buttons.ui-grid-row-selected:before{
content:'\2714' !important;
}
.ui-grid-all-selected:before{
content:'\2714' !important;
}
Try to include in your project :
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/angular-ui/bower-ui-grid/master/ui-grid.min.css">
<script src="https://cdn.rawgit.com/angular-ui/bower-ui-grid/master/ui-grid.min.js"></script>
If you are using gulp, add this task.
gulp.task('styles', function() {
// Copy font files needed for angular-ui-grid
gulp.src(['bower_components/angular-ui-grid/ui-grid.ttf',
'bower_components/angular-ui-grid/ui-grid.woff',
'bower_components/angular-ui-grid/ui-grid.eot',
'bower_components/angular-ui-grid/ui-grid.svg'
])
.pipe(gulp.dest('dist/styles/'))
// Other style tasks here
});
{
expand: true,
cwd: 'bower_components/angular-ui-grid',
src: ['.eot', '.svg', '.ttf', '.woff'],
dest: '<%= yeoman.dist %>/styles'
}
add this code to grunt file at copy: {
dist: {
If you use ui-grid - v4.6.6, you need to put ui-grid.ttf and ui-grid.woff into folder fonts. So the structure of directory will looks like this:
ui-grid.min.css
fonts # <-- this is a folder
ui-grid.ttf # <-- in fonts folder
ui-grid.woff # <-- in fonts folder
Adding this answer to hopefully save someone a headache. I had this problem and went through all the steps I could find. However, the problem wasn't file location, etc, my issue is the .woff file was corrupted. I downloaded the fonts to my local machine and ftp'd them to the server. Unfortunately, the .woff on the server ended up in a bad state and was bombing the #font-face declaration. Although this particular problem doesn't mention any console warnings/errors, they will match issues resolved by adding the fonts to grunt/gulp/etc.
I don't recall the error in Chrome, but in Firefox it was:
downloadable font: rejected by sanitizer
So, if you've gone through the hoops and nothing seems to work, check if the font files are correct because my FTP failed for .woff and it resulted in the same Korean characters, etc.

How can I exclude files

Using CMD from within Sencha Architect I've been able to build a production build of my application. However I can not seem to figure out how to exclude a js file from the build process. I don't want it compiled in with app.js I want it as a separate script include in index.html - so cmd shouldn't touch it basically.
Sencha Arhitech generates and calls build.xml which calls build-impl.xml which calls init-impl.xml
Everywhere I've read, they say to include the following;
<target name="-before-init">
<echo>Setting build.operations...</echo>
<echo>app.dir=${app.dir}</echo>
<property name="build.operations">
exclude
-file=\resources\js\version.js
</property>
</target>
However it refuses to exclude the file...I can see the echos so I know it's hitting the target..
Any ideas? Is this how I am supposed to exclude files?
app.framework.version=4.2.1.883
app.cmd.version=4.0.4.84
Turns out this won't be possible to do until Sencha Architect 3.1
Steps by which i was able to exclude AppConfig file in production build.
Here file exclude means it will not be compressed/bundled and variable/properties of this file could be used any where in the app.
1. Config file(AppConfig.js in our case) MUST be inside resources fodler. Below are the contents of our AppConfig file
/////////////IxDetect is my Application Namespace///////////////////
var IxDetect = IxDetect || {};
IxDetect.AppConfig = {
logoPath: '',
logoTitle: 'Internal',
pentahoUrl: 'http://107.20.104.150/pentaho',
pentahoRptCube: 'TrafficWithFraudIndex'
};
////////////////////////////////
2. Link this file in index.html page like below
<script src="resources/AppConfig.js"></script>
3. Add one more item in "js" array in "app.json" file
"js": [
{
"path": "resources/AppConfig.js", // This is my file. Also make a sure you do not miss bundle and includeInBundle property
"bundle": false,
"includeInBundle": true
},
{
"path": "app.js",
"bundle": true
}
],
4. Try development and production build all should work file
Note: All above changes are done and tested on 6.2(Framework/CMD)

Resources