Skip to content
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

improve asset loading APIs and document them #546

Closed
pskelin opened this issue Jun 14, 2019 · 9 comments
Closed

improve asset loading APIs and document them #546

pskelin opened this issue Jun 14, 2019 · 9 comments

Comments

@pskelin
Copy link
Contributor

pskelin commented Jun 14, 2019

Is your feature request related to a problem? Please describe.
There are four types of assets used by ui5-webcomponents
icons, CLDR, message bundles, theming parameters

There are sensible defaults (CDN or inline imports) so that developing without a build tool is possible, but configuring local bundling is not documented and the APIs are not unified.

Describe the solution you'd like
consistent APIs for configuration asset bundling/loading and documentation for them.

@emumanu
Copy link

emumanu commented Jul 29, 2019

I want to use ui5-webcomponents with Asp.net Core. Is it possible to use it adding some javascript files and/or css files without using node.js?

Is this issue is tracking that?

@MapTo0
Copy link
Member

MapTo0 commented Jul 30, 2019

Hello @emumanu

NodeJS is not required for consuming the web components at all. You just need a bundled version of the components. We are not providing a CDN usage yet. There are several options that you can choose between to get this working.

  1. Make your own bundling using webpack or rollup (recommended)
  2. Use https://unpkg.com/ as CDN (not really recommended)

Here is an example of rollup.config.json

import 'rollup'; /* eslint no-unused-vars: 0*/
import resolve from 'rollup-plugin-node-resolve';
import json from 'rollup-plugin-json';
import { terser } from "rollup-plugin-terser";


export default {
  input: "src/main.js",
	output: {
    file: "./public/bundle.js",
		format: "esm",
		sourcemap: true
  },
	plugins: [
		json(),
		terser(),
		resolve(),
	]
};

As starting point you can get https://github.com/rollup/rollup-starter-app

  1. Clone the project
  2. Add ui5-webcomponents as dependency
  3. Import the needed web components in the main.js file
  4. Enhance the rollup.config.js
  5. Build the project rollup -c
  6. Copy the built javascript placed in the public folder to your ASP project and consume it as a script

@emumanu
Copy link

emumanu commented Jul 30, 2019

Thanks for the tip @MapTo0

It would be good to have an "official development file" with the full bundle, even if its 10MB or more in size. It won't be used for production, but it would be good in order to try ui5 web components in 1 minute.

BR

@MapTo0
Copy link
Member

MapTo0 commented Jul 30, 2019

We are actually not providing as you call it "official development file" as we feel like it will be used in production as well. We even found some usages of the bundle.js which is deployed on github pages for our playground :D.

Easiest 1 minute consumption is probably the unpkg.com example https://jsbin.com/sepegiribe/edit?html,output

No build tool is required, but huge amount of javascript will be downloaded if several components are imported.

@emumanu
Copy link

emumanu commented Jul 30, 2019

I think that is a poor decision. If someone can do something wrong does not mean that you should avoid easy usage for other people that know the tradeoffs. You have knives at home, right?

Most developers have tight schedules and can't justify extra time to just try a library.

Anyway, I'm going to continue using OpenUI5 as UI5 web components doesn't have any form layout and the table it's too basic.

@MapTo0
Copy link
Member

MapTo0 commented Jul 30, 2019

Any feature requests are welcome :)

@emumanu
Copy link

emumanu commented Jul 30, 2019

  • "official development file"
  • some form layout like OpenUI5. This is the most important IMHO
  • components like sap.tnt for admin pages

With that implemented, I could invest some time to create asp.net core tag helpers to be able to use the ui5-webcomponents with Visual Studio intellisense support.
While that is not implemented and for apps that require more client side functionality, I will stick to my OpenUI5Sharp

BTW, does UI5-webcomponents share some source code with SAPUI5/OpenUI5?

BR and keep on your good work!

@vladitasev
Copy link
Contributor

Implemented.

About C# support, please open another issue, if necessary.

Regards

@emumanu
Copy link

emumanu commented Oct 14, 2019

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants