-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use minified enterprise(-ng) versions in angular-soho app. #149
base: master
Are you sure you want to change the base?
Use minified enterprise(-ng) versions in angular-soho app. #149
Conversation
<link rel="stylesheet" id="stylesheet" href="assets/ids-enterprise/css/theme-new-light.min.css" type="text/css"> | ||
<script> | ||
// https://github.com/infor-design/enterprise/tree/main/src/components/locale#code-example---using-minified-files | ||
window["SohoConfig"] = { minifyCultures: true }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to configure this in boilerplate/angular-soho/src/app/app.module.ts
instead? In the APP_INITIALIZER
where the locale is set.
Functionally there shouldn't be a difference, but it's nice to do the locale/culture config in a single place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property Locale.minify
of infor-design/enterprise project isn't "published" in https://github.com/infor-design/enterprise-ng/blob/main/projects/ids-enterprise-typings/lib/locale/soho-locale.d.ts
to be directly used in Angular projects. I can add Soho.Locale['minify'] = true;
to app.module.ts
, but it looks a little bit tricky and isn't well "documented". How should we proceed @anhallbe? Should I create a PR in infor-design/enterprise-ng project to make the Locale.minify
property available to Angular projects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add the following to extend the SohoLocaleStatic
typing, for better type safety and documentation:
// app.module.ts, or possibly polyfills.ts?
declare global {
interface SohoLocaleStatic {
/**
* Instructs IDS to load minified localization files.
* NOTE: Not part of the official IDS typings. Since this is not part
* of the official API, it may stop working at any time.
*/
minify: boolean;
}
}
and then in the APP_INITIALIZER:
// app.module.ts
{
provide: APP_INITIALIZER,
multi: true,
deps: [LOCALE_ID],
useFactory: (locale: string) => () => {
Soho.Locale.minify = true;
Soho.Locale.culturesPath = 'assets/ids-enterprise/js/cultures/';
Soho.Locale.set(locale);
},
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think @tmcconechy, should the project @infor-design/enterprise-ng publish the minify
property from @infor-design/enterprise projects Locale
? I would avoid unofficial features in odin new
generated files. The official documentation in @infor-design/enterprice only mentions the following:
That's the reason why I'm not sure how to handle this situation.
I think that setting just loads the So maybe you could use it if it still works? Or do the same and load the locales in with But they are published as minfied if you look in node_modules/ids-enterprise/dist/js/cultures |
I believe my question wasn't precise enough. Let me try it again. The GoalWe want to use the minified culture js files in a Angular project. The documented way we can reach itSetting the SohoConfig.minifyCultures to true before Soho.Locale will be initialized. We can reach this by putting the following code into index.html <script>
window["SohoConfig"] = { minifyCultures: true };
</script> The way that we want to goWe want to set the usage of minified culture files in the same way we set the path to the cultures itself in our Angular module, before we set/load the current locale. Example: Soho.Locale.culturesPath = 'assets/ids-enterprise/js/cultures/';
Soho.Locale.minifyCultures = true; Why we can't/won't go this wayCurrently there is no "public" property in The final questionIs it possible to introduce the property |
@anhallbe, do not merge the PR now. The build of Angular Soho App breaks as expected but the workflow is successful. I will take a look on it. |
@anhallbe, I have changed the No the build breaks, which is my expected behavior for the moment. If there is a newer version of |
You can keep it in the PR |
@anhallbe, |
This PR is a replacement of #114 to use minified version of themes and cultures in applications generated with
odin new
. See also the issue #118. Thank you to @dohjon for the example!Currently there is no option to include
theme-new*
files only.