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

RFC: Allow to easy reference additional assets shipped with DNN javascript library #3382

Closed
roman-yagodin opened this issue Dec 6, 2019 · 10 comments

Comments

@roman-yagodin
Copy link
Contributor

roman-yagodin commented Dec 6, 2019

Description of problem

It's hard to reference additional assets shipped along with DNN javascript library package, e.g. CSS, images, fonts, non-main scripts, etc. Currently we need to re-implement (or borrow) non-public parts of DotNetNuke.Framework.JavaScriptLibraries code to do this.

Description of solution

Option 1 (partial solution)

Just make Javascript.GetHighestVersionLibrary() method public.

This will allow reference additional assets (see example below), but only from highest library version:

JavaScript.RequestRegistration ("JSLibrary");
var jsl = JavaScript.GetHighestVersionLibrary ("JSLibrary");
if (jsl != null) {
    ClientResourceManager.RegisterStyleSheet (Page, "/Resources/Libraries/JSLibrary/"
        + Globals.FormatVersion (jsl.Version, "00", 3, "_")
        + "/css/stylesheet.min.css",
        (int) FileOrder.Css.SkinCss,
        "DnnPageHeaderProvider",
        "js-library",
         jsl.Version.ToString ()
    );
}

Option 2 (more general solution)

Make the Javascript.GetHighestVersionLibrary() method public and also introduce following public methods:

public static JavaScriptLibrary GetLibrary (string jsname, Version version, SpecificVersion specific);
public static Version GetHighestVersion (string jsname);
public static Version GetVersion (string jsname, Version version, SpecificVersion specific);
@bdukes
Copy link
Contributor

bdukes commented Dec 6, 2019

This looks great to me.

In addition, I'd think it would help to either be able to request a resource relative to a library, or to get the path of a library.

It could look something like this:

var jsl = JavaScript.GetHighestVersion("JSLibrary");
var path = jsl.GetAssetPath("css/stylesheet.min.css");
ClientResourceManager.RegisterStyleSheet(Page, path);

Or like this:

var jsl = JavaScript.GetHighestVersion("JSLibrary");
ClientResourceManager.RegisterStyleSheet(Page, jsl, "css/stylesheet.min.css");

@stale
Copy link

stale bot commented Oct 26, 2020

We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically.
If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!

@stale stale bot added the stale label Oct 26, 2020
@roman-yagodin
Copy link
Contributor Author

Please don't close!

@stale stale bot removed the stale label Oct 27, 2020
@stale
Copy link

stale bot commented Jan 25, 2021

We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically.
If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!

@stale stale bot added the stale label Jan 25, 2021
@sleupold
Copy link
Contributor

anyone to submit a PR, @roman-yagodin ?

@stale stale bot removed the stale label Jan 25, 2021
@roman-yagodin
Copy link
Contributor Author

Well, maybe. Probably will take quite some time, though.

@stale
Copy link

stale bot commented Jun 2, 2021

We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically.
If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!

@stale stale bot added the stale label Jun 2, 2021
@roman-yagodin
Copy link
Contributor Author

Bump!

@stale stale bot removed the stale label Jun 2, 2021
@stale
Copy link

stale bot commented Sep 3, 2021

We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically.
If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!

@stale stale bot added the stale label Sep 3, 2021
@stale
Copy link

stale bot commented Sep 21, 2021

This issue has been closed automatically due to inactivity (as mentioned 14 days ago). Feel free to re-open the issue if you believe it is still relevant.

@stale stale bot closed this as completed Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants