Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@tilde-nlp/ngx-common
Advanced tools
Functions/components that might be usefull to share.
This library contains images folder which contains at least tildes logo and favicon. To add them to your project append angular.json
file - projects.{appName}.architect.build.options.assets
with this object:
{
"glob": "**/*",
"input":"./node_modules/@tilde-nlp/ngx-common/images",
"output":"images"
}
After this, your images will be under: http://localhost:4200/images/
.
This library contains also scss files so some kind of common styling can happen between different projects. Idea is to provide scheme for common color usage and easy configuration of them.
Also fonts and material icons are stored in this library for offline use and direct import.
The goal of these scss files is to create default color pallete, and some common styles for components, and make it easier to change layout colors.
Note, this is not recommended way, since you miss out other defined styles
To be able to use default tilde colors, you need to import sass-variables-to-css
mixin and include it in your stylesheet as follows:
/* Your stylesheet, eg. styles.scss*/
@import "ROUTE_TO_STYLES_FOLDER/sass-variables-to-css.mixin.scss";
...
@include sass-variables-to-css();
After that you can start using pre defined tilde colors as follows:
.my-class {
color: var(--TILDE_COLOR_NAME);
}
Check the list with available colors. It is also easy to append or override default colors:
/* Define your own custom color map*/
$my-pallete: (
my-color-1: red,
my-color-2: green,
);
/*Pass it to sass-variables-to-css mixin
Note that you need to include this mixin only once.*/
@include sass-variables-to-css($my-pallete);
Recommended way _this way includes additional mixins for easier component sytyling. For more accurate, check source code.
Instead of sass-variables-to-css
import tld-all-mixins';
. Example:
/*Import mixin*/
@import "ROUTE_TO_STYLES_FOLDER/mixins/tld-all-mixins.mixin.scss";
/*Include mixin*/
@include tld-all-mixins();
Note that you can use same approach to override or append default tilde color pallete.
Import tilde-style.scss
to acces pre defined styles for easier component styling.
Service created to register custom icons and use them with angular svgIcon.
This library offers custom missing translation handler that is based on ngx/translate
. This handler allows to pass default value to translate
pipe. This is useful when there is some localization key, that is dynamic and there can be situations that it is not translated in any of languages - in this case by default localization key gets show, but you may want to handle this by showing some basic value from object.
Usage:
Configure custom missing translation handler as provider:
// in module where you import TranslateModule
import { MissingTranslationHelper } from '@tilde-nlp/ngx-common';
....
TranslateModule.forRoot({
missingTranslationHandler: {
provide: MissingTranslationHandler,
useClass: MissingTranslationHelper
}
})
Pass default value to translate pipe in component:
{{'KEY_THAT_DOES_NOT_EXIST' | translate: {default: 'My default value'} }}
FAQs
Functions/components that might be usefull to share.
We found that @tilde-nlp/ngx-common demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.