Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 12 2020 01:41

    jtkech on patch-1

    (compare)

  • Apr 12 2020 01:39

    jtkech on patch-1

    Update ZoneShapes.cs (compare)

aaronamm
@aaronamm
Does any body know why script at does not work?
I am trying to add <script asp-name="bootstrap" at="Foot"></script> to my layout.cshtml for my custom theme.
Then, the script does not render at root of HTML page.
After I have remote at="Footer", it works.
Setting at="Head" does not render as well.
I would be glad if someone can help me for this.
Thanks
The admin works but I don't know why it does not work for my custom theme.
image.png
aaronamm
@aaronamm
Good start, the default theme work.
image.png
aaronamm
@aaronamm
Got it work by using a default theme but can't get it work with a custom theme from dotnet new octheme -n "ThemeName.OrchardCore"
aaronamm
@aaronamm
It is possible that disable/enable theme fix the issue but I am not 100% but right now a custom theme that I made from dotnet new octheme work.
4 replies
Aleksey Filippov
@happygrizzly
Hi there everyone!
Can you plese advise a development routine using webpack for a separate module / theme.
So far I have created a separate theme project, referenced it in the main CMS project. Theme project contains a webpack configuration. The production configuration is more understandable for me. I'm not sure how to do it with when in development?
My motivation is to use picked modules / scss from bootstrap npm package.
I also added purgecss to my development webpack config.
And I was going to use LiveReloadPlugin
so I could put a dev / livereload server's url to Orchard's resource manifest
Aleksey Filippov
@happygrizzly
as a development script
Aleksey Filippov
@happygrizzly
I'm not sure about PurgeCss and the Views paths. I'm not sure if purgecss will process paths to the cshtml / liquid views properly. In the theme project, in the postcss.config.js I define the paths patterns as './Views/**/.cshtml' and ./Views/\*/*.liquid' accordingly.
somecodeguy
@dafergu2:matrix.org
[m]
@happygrizzly: I JUST finished integrating vite into my development/prod build workflow. It'd be pretty similar. My motivation for using vite versus webpack was that 1) I'm using vue to create reactive content on my site and vite works well with Vue out of the box and 2) it uses rollup under the hood to package and bundle scripts. Rollup is a little easier to deal with building multiple bundles (each of my content item vue components would be its own entry point).
PurrgeCSS is working fine scanning our liquid and cshtml files
So, the main points. If you can get webpack bundling your resources properly, you'll have two different paths to get things working. 1) How do you register your scripts and stylesheets properly with a released version of your site, and 2) How do you use the same registration to redirect to a different file name when running in development mode.
I'm planning on writing a detailed blog post about it. It really has made a huge difference in our development inner loop and made things more efficient.
somecodeguy
@dafergu2:matrix.org
[m]
But a quick synopsis. 1) You'll need to register your stylesheets and scripts using the ResourceManagementOptionsConfiguration class in your theme. You'll need to dynamically determine the actual Url of the file based on whether or not your in development mode. In my case, the production built files end up in wwwroot/dist/*.<filehash>.{js|css}. Vite generates a manifest file that indicates the resulting bundled file names based on the original file location. I parse that and use that data to determine the actual file name and url of the resource when it is in production. When in development, I use the original file name and location as the url since I am using the vite's HMR dev server for live reload.
When in development, I register a proxy for all of the resources vite would be bundling for me. So, in my Startup.cs I have the following:
if (env.IsDevelopment())
{
    ...
    app.UseViteDevelopmentEnvironment();
}
and that method looks like this...
somecodeguy
@dafergu2:matrix.org
[m]
public static IApplicationBuilder UseViteDevelopmentEnvironment(
    this IApplicationBuilder builder)
{
    // Use the vite dev server as a proxy for all of the ts or css files
    return builder.MapWhen(context => IsViteResource(context), builder =>
    {
        builder.Use(async (context, next) =>
        {
            var oldUrl = (string)context.Request.Path;

            // Patch the hmr client.  It doesn't respect the base url path in the
            // vite config.  There is an outstanding PR to fix this in the vite repo.
            // https://github.com/vitejs/vite/pull/3495
            if (oldUrl.EndsWith("@vite/client"))
            {
                var newUrl = oldUrl.Replace("@vite/client", "patches/vite-hmr-client.js");
                context.Request.Path = newUrl;
                context.Request.QueryString = new QueryString("");
            }

            await next();
        });

        builder.UseSpa(spa =>
        {
            // TODO: Make this configurable if needed.  We would also need to make the vite
            // server configurable as well.
            spa.UseProxyToSpaDevelopmentServer("http://localhost:3000");
        });
    });
}

private static bool IsViteResource(HttpContext context)
{
    var url = (string)context.Request.Path;
    var lowerUrl = url.ToLowerInvariant();
    if (lowerUrl.Contains("firefliestheme")
        && (lowerUrl.EndsWith(".ts")
            || lowerUrl.EndsWith(".js")
            || lowerUrl.EndsWith(".css")
            || lowerUrl.EndsWith(".pcss")
            || lowerUrl.EndsWith(".vue")
            || lowerUrl.Contains("@vite"))
            || lowerUrl.Contains("/vite/")
            || lowerUrl.Contains("node_modules")
        // TODO: Once we figure out how to deal
        //   with the bug in the vite HMR client, determine if we
        //   should filter based on the /dist/ folder
        // && !lowerUrl.Contains("/dist/")
        )
    {
        return true;
    }
    return false;
}
The above startup code is your web project, not your theme project. Also, the mention to firefliestheme in the code, that's the name of my theme module.
You also need to reference this package in your main web project. <PackageReference Include="Microsoft.Aspnetcore.SpaServices.Extensions" Version="5.0.6" />
somecodeguy
@dafergu2:matrix.org
[m]
MS does have a package that is webpack specific. I wouldn't advise using it though, even though a lot of blogs show that you should. The reason is that it is now deprecated. MS is now recommending that for a true spa, you use the development server of webpack/react/angular/vue/whatever and then have it proxy all calls it doesn't server to your dotnet process. That doesn't work well here, and they are still supporting the generic proxy api (that I use above) from the Microsoft.Aspnetcore.SpaServices.Extensions package
somecodeguy
@dafergu2:matrix.org
[m]
@happygrizzly: I hope all of the above I posted helps. I spent a good amount of time getting this to work over the past several weeks. The end result is that I can use full vue SFC components, typescript, and 3rd party packaged js components easily now. All of my JS is now in typescript as well.
4 replies
Aleksey Filippov
@happygrizzly
Thank you very much! I'm going to investigate this. In my case I don't need a spa. Considering my requirements it would be easier to go with next.js as a separate frontend project. But - believe it or not - company doesn't like the idea of node/next.js.
3 replies
S├ębastien Ros
@sebastienros
@deanmarcussen @Skrypt @agriffard won't be able to join the triage until 10:15 PT (15 minutes late)
What is Dave's alias so he's aware?
somecodeguy
@dafergu2:matrix.org
[m]
@sebastienros: Do you mean me?
I'm guessing not. :)
Dean Marcussen
@deanmarcussen
@sebastienros I can't make it all tonight :( Dave was daveblack, but he has changed his name I think, optimal?
Antoine Griffard
@agriffard
Dave Black : @daveblack101
Dave Black
@daveblack101
Gotcha. Cheers guys
S├ębastien Ros
@sebastienros
I am in the room already
somecodeguy
@dafergu2:matrix.org
[m]
What could cause a page being rendered to not respect templates? I've got a custom route that returns a view in which I render a shape. I've tried changing the alternate but the rendered page doesn't have an alternate listed in its model. I've also tried overriding the template with the admin tool and with a cshtml in my theme to no avail. I feel like it is something simple that I'm not understanding.
vmahant
@vmahant
Any Idea I can't see image on frontend. Shortcode feature is enabled though
image.png
image.png
image.png
am I missing something?
Tony Han
@hyzx86

Are there any methods or modules that
Mapping existing relational database entity types to OrchardCore (Yessql) Model
It is possible to automatically create types based on existing types with only simple adjustments

Maybe it can also automatically synchronize data to a relational database?

aaronamm
@aaronamm
I have a custom module and configure OrchardCore.PublishLater as dependency.
However, when I enable my custom module it won't automatically enable OrchardCore.PublishLater module?
Can someone help me one this? Thank you.
[assembly: Module(
    Name = "MyModule",
    Version = "0.0.1",
    Category = "Content Management",
    Dependencies = new[]{
        "OrchardCore.PublishLater",
    }
)]
7 replies
aaronamm
@aaronamm
Should I use _shellFeaturesManager.EnableFeaturesAsync or recipe.json? I think we have something like this in Orchard 1 but I don't know to get it work with OC.
mmdqq
@mmdqq
how to use aspnet-contrib/AspNet.Security.OAuth.Providers in Orchardcore?
somecodeguy
@dafergu2:matrix.org
[m]
@sebastienros @deanmarcussen Thoughts about OrchardCMS/OrchardCore#9615 I'd like to get that merged in as I'm hoping to rely on some timezone updates in .NET 6 preview 4.
CrestApps
@CrestApps
Is there an example of how to change the template of the default pager?
28 replies
somecodeguy
@dafergu2:matrix.org
[m]
Hrm, this is really bothering me. My template is not being applied for a very specific use case. Here's my scenario.
I have a generic content type called Liquid Page. I have a simple content item of type Liquid Page with a well known alias. I have a module that exposes an endpoint on a controller via a [Route] attribute. The controller queries a 3rd party database to get some information. Then it creates a shape for the content item with the well known alias and renders it by passing that shape to the View() method. The cshtml simply does a @DisplayAsync.
I tried creating a Content-LiquidPage template in my theme. This is used for all over Liquid Page content items, but for the one that is rendered via my custom route, it is not.