SolidOS/solid-ui

Acccess to solid-ui from a CDN

Closed this issue · 26 comments

@jeff-zucker

Access to npm published version is from lib/index.js
The file contains :


--------------
if (typeof window !== 'undefined') {
  ;
  window.UI = {
    authn: _solidLogic.authn,
    store: _solidLogic.store,
    ns: ns,
    rdf: rdf,
    acl: _index.acl,
    aclControl: _index.aclControl,
    create: _index2.create,
    createTypes: createTypes,
    dom: dom,
    icons: _iconBase.icons,
    language: language,
    log: log,
    login: login,
    matrix: _index3.matrix,
    media: _index4.media,
    messageArea: _messageArea.messageArea,
    infiniteMessageArea: _infinite.infiniteMessageArea,
    pad: pad,
    participation: participation,
    preferences: preferences,
    style: style,
    table: _table.renderTableViewPane,
    tabs: tabs,
    utils: utils,
    widgets: widgets,
    versionInfo: _versionInfo.versionInfo,
    initHeader: _header.initHeader,
    initFooter: _footer.initFooter
  }; // Simpler access by non-node scripts
}
-----

Is it enough to use in a script tag ?
lib is not accessible from github ? is it a must ?

No, lib/index.js is not a browser- accessible library. If I put that in a script tag, it barfs on the require statements. The only thing, as far as I know that works in a browser from a CDN is dist/main.js.

So my suggestion would be to build it at the same time you build mashlib and place it also in https://solidcommunity.net/main.js so it can be accessed the same way mashlib is for those apps (like many I am working on) which do not need panes.

To document why this is useful - I am working on a variety of apps that use the solid-ui-components framework but do not need the panes that come with mashlib. If we want to make solid-ui and SolidOS available to developers, this would greatly simplify things. Additionally, it should be minified because currently solid-ui takes a long time to load.

Or, instead of serving from solidcommunity.net, f the dist folder is built and included in the npm, then I believe npmjs will automatically create a CDN for it. Or the same for github.

We could publish solid-ui on github as we do do mashlib on the gh-pages branch (see: https://github.com/SolidOS/mashlib/tree/gh-pages)

It is for now here: http://solidos.github.io/solid-ui/dist/main.js -> we need to change its name to solid-ui.js before we make use of it.

I propose we add :

  • dist/main.js in github
  • and something in the README.md

@bourgeoa - it is already there and @timea already documented in the Solid-ui readme.

Could be added that dist/main.js being published in npm it is available in CDN like jsdelivr

@bourgeoa I can't find it on either npmjs CDN or jsdelivr CDN.

@jeff-zucker can you look to branch browser in dist/
can you try dist/solid-ui.js

I built solid-ui 2.4.22 and in a web-app, I can point at solid-ui/dist/main.js and it works fine. There is no main.js on github.io. If I use https://solidos.github.io/solid-ui/dist/solid-ui.min.js (with or without the min) I get the following errors and nothing works.

solid-ui-error

One of the reasons this is a problem is that a demo of solid-uix can work with solid-ui rather than mashlib and runs considerably faster because it does not have to load the panes. So I'd really like to be able to point to a stable solid-ui online. It's not totally critical though - I can load mashlib instead and just have it work slower. So if you're swamped for time, you can back burner this.

When I npm install solid-ui 2.4.27 from npm and point to dist/main.js the web version works fine. The online solid-ui.js does not.

@jeff-zucker I just updated to the correct link
could you try https://solidos.github.io/solid-ui/dist/solid-ui.js

Well if it works ? shall I keep that link or do you prefer a solid-ui.min.js ?
But may be it is a bad idea to have changed the name and main.js was better. I don't know

I get the same error as previously "Automatic publicPath is not supported".

Yes, it would be much simpler to just keep the existing URL and simply build and include dist when you push to github. There is no reason this should be a separate file from main.js which is generated automatically on build.

What I wonder is why dist/main.js works perfectly and this thing does not and why they should be two different files.

@jeff-zucker right now there is only one solid-ui or main. It used to be main now it is solid-ui.
The problem could occur in any name we chose from what I read.

@jeff-zucker merged #547 to main. Could you check if the issue is resolved

I can confirm this works with both dist/solid-ui.js and dist/solid-ui.min.js work when I clone main and build locally but am unable to find them at https://solidos.github.com/solid-ui/dist/solid-ui.js.

Thank you for the collaboration to get this fixed, much appreciated!

I can confirm the github.io CDN works, thanks much!