MEAN.io MyPackage.aggregateAsset global: false still applies to entire site - mean.io

When I set global: false in the app.js for a package, the css is still applied to the entire app instead of just that package. You can test with with mean upload package. For example set the h1 background to purple in the public/assets/css/meanUpload.css and then set global: false in the app.js
Upload.aggregateAsset('css', '../css/meanUpload.css', {
global: false
});

you are misunderstanding the purpose of the global attribute. Global is only to say if the code that you want to add is going to be wrapped by a closure or not.
You can check that here : http://learn.mean.io/#mean-stack-packages-assets-and-aggregation

Related

How to define custom default values for TYPO3's site configuration?

By creating a file /Configuration/SiteConfiguration/Overrides/sites.php in a site package, it is possible to modify default values, such as …
<?php
defined('TYPO3') or die();
$GLOBALS['SiteConfiguration']['site_language']['columns']['title']['config']['default'] = 'Deutsch';
$GLOBALS['SiteConfiguration']['site_language']['columns']['typo3Language']['config']['default'] = 'de';
..., or even add new fields to the backend form.
Is it also possible to define some default values that do not appear in the backend form but are still automatically created in a new sites.yaml files?
For example, it is about the following values:
routeEnhancers:
PageTypeSuffix:
type: PageType
map:
sitemap.xml: 1533906435
settings:
redirects:
autoUpdateSlugs: false
autoCreateRedirects: false
redirectTTL: 0
httpStatusCode: 301
This could allow TYPO3 admin users to create new pages with the previously defined settings without having to (or being allowed to) edit the yaml files directly.
Addendum:
I found out that the default values are set via the function createNewBasicSite(). Perhaps this can be extended or overwritten somehow.
It is not possible to set default values, however I suggest a different solution which is possible since TYPO3 version 10.4 (see)
You can import settings from other files, which are e.g. within your site package.
imports:
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" }
another:
option: true

Prevent Flutter/Dart format reordering variable declarations

Is there a way to prevent the dart formatter from reordering variables alphabetically? I can't find a linting rule for it although there's the similar directives_ordering for imports.
For example
var variableA; //A
var variableC; //C
var variableB; //B
gets reordered to
var variableA; //A
var variableB; //C
var variableC; //B
leaving comments in place.
This is especially problematic when I group constants together with a similar purpose and they get split up/mixed with other different constants making the accompanying comments useless/confusing.
I'm using Flutter 2.5.0 on VSCode 1.60.0 with include: package:flutter_lints/flutter.yaml in my analysis_options.yaml file.
Thanks for your help
For me it turns out this was due to the dart plugin for VSCode. Specifically the source.sortMembers value in the editor.codeActionsOnSave of my VSCode configuration file.
Setting this to false stops the variables being reordered.
The same behavior happens if you press CTRL + Shift + P and run Dart: Sort Members.
Apply it for the entire project
Open your analysis_options.yaml file
add this line to it
directives_ordering: false
Complete code
include: package:flutter_lints/flutter.yaml
linter:
rules:
# avoid_print: true # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
directives_ordering: false

Eslint & SAPUI5: How to remove "sap/$ not defined"?

I am using Eslint in Visual Code for my SAPUI5 project. Whenever I am defining a controller using
sap.ui.define([...
Eslint throws the error sap not defined.. The same holds for $/jQuery. Is there a way how to solve that?
Thanks
You can whitelist global variables in the eslint configuration: https://eslint.org/docs/user-guide/configuring (see "Specifying Globals").
To configure global variables inside of a configuration file, use the
globals key and indicate the global variables you want to use. Set
each global variable name equal to true to allow the variable to be
overwritten or false to disallow overwriting. For example:
{
"globals": {
"var1": true,
"var2": false
}
}
Usually you have some kind of .eslintrc.js file where you can include this.
Here is an example: https://github.com/pulseshift/openui5-gulp-starter-kit/blob/master/.eslintrc.js

How to dictate a global variable in specific karma test block

I'm trying to write a test in Karma for a react/webpack application that tests conditionals depending on global variable __CLIENT__ being false or not.
How do I go about making it true for one it block, and then false for another? I tried setting global.__CLIENT__, but the console.logs from my module return true regardless of what I try to set it to in my tests.
How do I do this, hopefully in a way that keeps just one file and can be dictated in each test case. That avoids the karma.conf....
Probably won't help you now but maybe for others:
you need to create global.js file for example and within karma webpack files add it at the start of "files"
files: [
'./tests/global-variables.js',
{pattern: 'src/**/*-spec.js', watch: false}
],
And within global-variables.js:
var global = {
___CLIENT___: "some data"
}
Good luck!

Setting the --in-source-map uglify2 config option in r.js build config file

I wanted to use the --in-source-map option that is available in UglifyJS2 for consuming a source map file and outputting a new one along with the compressed js, thereby performing a multi-level source mapping. I am using r.js to do the minification of the javascript files and so I saw there was a way to define config values that will be passed on to the UglifyJS2. Here is a sample showing how it is done in the r.js build file:
uglify2: {
//Example of a specialized config. If you are fine
//with the default options, no need to specify
//any of these properties.
output: {
beautify: true
},
compress: {
sequences: false,
global_defs: {
DEBUG: false
}
},
warnings: true,
mangle: false
},
Obvously r.js has its own way of structuring the config options and I was not able to figure out how to set the --in-source-map option following this structure. I tried putting the following statement in the output element or the compress element or even outside, next to the warnings config option.
in-source-map: sample.map
I have also tried putting quotes around the file name. Unfortunately none of the methods worked. Can anyone help me figure out this problem? Can it also be the case that this option is not supported in r.js?