Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Casey Brooks
    @cjbrooks12

    You're nearly there in that branch. Orchid is picking up your Theme class and using its layout properly, it's just a matter of getting your scripts and stylesheets set up now.

    Basically, in your layout where you have your <link> tags for CSS in the <head>, replace all of those with {% styles %}, and the same for replacing the <script> tag block with {% scripts %}. And then you'll want to override the loadAssets() method of your theme to add the necessary scripts/styles there. See this example

    Also, some of the file names aren't going to play nicely with Orchid right now. If it's got a name with multiple dots (like styles.default.css or owl.carousel.css), you'll want to rename it so that there's only a single dot for the extension. I'm working on fixing that behavior in the next major version
    Casey Brooks
    @cjbrooks12
    And finally, if you want to add customizability to your theme, any fields in the theme class annotated with @Option will be set automatically from the theme configuration in config.yml. For example, you could set up an enum with the different "style" names (default, blue, marsala, etc.). See here for defining the enum and here for it being added to the Theme class, and here for it being used in the theme config
    Samer Kanjo
    @skanjo
    Your wrote that Orchid is picking up my theme but I still receive an error from ThemeServiceImpl that the theme could not be found. Is there some other signal to indicate that it is finding the theme that I am not finding? In the generated home page the debug comments indicate the Default theme was used so I am guessing my theme was not found.
    Samer Kanjo
    @skanjo
    I am starting to think it is a Gradle problem. I deliberately added a compile time error to my theme class and ran gradle clean orchidBuild and it did not discover the compile error. I think orchidBuild and orchidServer are not building the theme project. I am trying to learn how to do this in Gradle. It is not very clear how this should be working, my understanding of Gradle that is.
    Samer Kanjo
    @skanjo
    It was a Gradle problem. When using the java plugin I had to include dependency scope of the theme project twice in the site project, once using implementation or compile, as well as orchidRuntime. If I did not include both scopes the theme is not found by Orchid. I tried using the java-library plugin with the implementation and orchidRuntime scope but it does not work though I am positive it did work in an earlier iteration. From java-library plugin docs it may be necessary to have both api and implementation but it is not clear to me.
    Now that I have the build working I can see that none of my assets from the theme are added to the site. I will try the load assets suggestion and see how it goes.
    Samer Kanjo
    @skanjo
    The dot in files names is not consistently a problem. I think, if the file ends in min.js then having any number of dots in the name is fine. Also dots in folder name a problem as well. Also looks like I need to add images to assets in theme as well.
    I noticed when working on site using default them that all media was included. For the theme it does not seem to be the case. Should all media assets in a theme be included by default or must the media assets be loaded using the theme?
    Samer Kanjo
    @skanjo
    I can work on the dot in file name problem. I was looking at open issues but did not see anything relevant. Is there an open issue?
    Casey Brooks
    @cjbrooks12
    Ah, yeah not picking up the theme sounds like a Gradle issue. Gradle is a beast of a tool and can be confusing and unintuitive at first,but once you get to know how it works and treats builds/projects, it starts to get easier. Make sure to include assemble before running Orchid (./gradlew clean assemble orchidServe), which will ensure your theme is compiled properly and should then be picked up by Orchid.
    For dependencies, you will want to include only the OrchidCore artifact as an implementation dependency of your theme module. Only if you are specifically wanting to extend a class from a plug-in do you need the plugin artifacts in your theme project, and you really shouldn't need to at all.
    Casey Brooks
    @cjbrooks12
    The orchidRuntime scope is what is actually used to run Orchid. It also includes everything from orchidCompile of the same module, but does not include api, implementation or compile from that module or any others, unless you specifically tell it to (via orchidRuntime project(”:theme”))
    Casey Brooks
    @cjbrooks12
    For dots in names, .min is a common convention that is used, so it has an exception. It's not in an open issue or anything, it's just an old feature I keep running into issues with and have been wanting to remove for a while.
    Casey Brooks
    @cjbrooks12
    For adding images, you'd typically have those added to the page with the asset Pebble filter. This will ensure each file referenced gets copied to the output site and includes the base URL.
    Casey Brooks
    @cjbrooks12
    The files in assets/media are copied over by default when it is in the site content resources dir, but not from the theme or plugins (to avoid copying over theme/plugin stuff that may never be used, depending on configurations).
    Samer Kanjo
    @skanjo
    Do you know how to use Gradle install the JAR theme to local maven repo? It seems like there used to be an install command but that has been deprecated.
    I was looking through Orchid code and it looks like the filename parsing is in OrchidReference. Is that the only location? I was thinking of trying to modify to handle dots in filename or path.
    Samer Kanjo
    @skanjo
    One of the issues I am having is getting images from the theme to work in the site, it does not seem possible. Using asset syntax as you suggested only attempts to get images from the site and not from the theme. Unless there is some additonal config to asset I am missing. From the Copper theme example is seems like images can be included as part of a theme configuration in which an image from the theme can be used as a default but then that image can be overridden in the site. It seems like that would be the preferred way so I am going to try it.
    Casey Brooks
    @cjbrooks12
    You can use the maven-publish Gradle plugin to install the jar to your local .m2 repository, with ./gradle assemble publishToMavenLocal. You'd add that plugin for the theme module. This is the replacement for the deprecated maven publishing plugin
    Yes, filename parsing is done in OrchidReference. The following snippet in config.yml should also work to set custom "dot" sections in your filenames that are kept in the filename instead of being parsed out:
    services:
      compilers:
        ignoredOutputExtensions:
          - 'min'
          - 'bundle'
          - '...'
    Samer Kanjo
    @skanjo
    Thanks, I will try out the Gradle config and look into the custom output extensions.
    One of the issues I am having is getting images from the theme to work in the site, it does not seem possible. Using asset syntax as you suggested only attempts to get images from the site and not from the theme. Unless there is some additonal config to asset I am missing. From the Copper theme example is seems like images can be included as part of a theme configuration in which an image from the theme can be used as a default but then that image can be overridden in the site. It seems like that would be the preferred way so I am going to try it.
    The template I am converting contains webfonts, which are local assets, that include query parameters. These are not handled either, I think due to the same issue with parsing file names to find extension and ultimately the type of file. A lot of the assets, JS and CSS, in this template use dot in the file name quite a lot, not sure if this is from the creator of the asset or a choice made by the designer of the template. I was thinking of changing as many of these from local assets to pulling from a CDN.
    How can I include fav icons or apple touch icons etc? I was thinking of making this a configuration in the theme with a default to use the ones from the theme which can then be customized by the site. That seems to make sense given how people would use the theme.
    For the image assets, I am now thinking of punting and just moving them all from the theme to the site and sort it out later.
    Casey Brooks
    @cjbrooks12
    There are a handful of things that aren't quite as easy as they need to be for full theme development. The URLs for Google Fonts can't get parsed correctly and all the additional files for Font Awesome are difficult to handle, so I'd suggest just referencing those directly from a CDN rather than trying to use Orchid's asset management for those.
    And I'm getting the images to load properly on my end. I'll send a PR your way in just a bit for you to see its intended usage
    Screen Shot 2019-09-01 at 1.27.42 PM.png
    Samer Kanjo
    @skanjo
    Oh wow! Yeah none of the images load for me, cause seems to be missing from the site docs. I assume they are not being included from the theme. What is your secret???
    Casey Brooks
    @cjbrooks12
    For favicons, Orchid currently only supports a single favicon.ico file, just as src/orchid/resources/favicon.ico, which is included by default. For the other images, you'll need to just have the apple-touch-icon links in the <head> manually. And yes, those images are being referenced from the theme module, and copied to the rendered site!
    Samer Kanjo
    @skanjo
    Did you modify my code locally to get it working?
    Casey Brooks
    @cjbrooks12
    Yup, I cloned your repo and am serving it with ./gradle clean assemble :site:orchidServe. You'll also need to stop and rerun that command on any changes to the theme (because Gradle needs to recompile the jarfile for Orchid to read it)
    Samer Kanjo
    @skanjo
    Cloned and have not changed anything?
    Casey Brooks
    @cjbrooks12
    Yeah, I'm making some changes. I'll open a PR on your repo with these changes in just a bit
    Samer Kanjo
    @skanjo
    Ah, ok, thank you!
    Casey Brooks
    @cjbrooks12
    Alright, I opened the PR on your repo
    Samer Kanjo
    @skanjo
    Thank you very much! I will test it out today.
    Casey Brooks
    @cjbrooks12
    Let me know if anything is still unclear or if you have any other questions!
    Samer Kanjo
    @skanjo
    Thanks for the PR, I have merged it and find it working well. Now moving on to figure out how to get the main content area of the home page in. Iterating.
    Samer Kanjo
    @skanjo
    lol, man i really a bit a lot off starting out with this template!
    Samer Kanjo
    @skanjo
    Making progress but got stuck on something. I have a background image defined in a theme css file. How can I update that to use a theme image file? I do not think I can use asset in the css as that is for template files only, I believe.
    For now I just added a style for the background to live next to the class.
    Casey Brooks
    @cjbrooks12
    Yeah, theme development is a bit more involved than just normal usage of Orchid, but I'm glad to hear you keep working on it! Once you get the main concepts down (templates, components, menus, and assets) I think you'll find nearly everything to just be some variant of that, and it will get easier. Just keep going through the source for the 4 official themes, they will be your best guide for the specifics you want to implement.
    And you are totally able to inject theme variables into your css/J's assets. It's actually done the same way you'd add stuff to content pages, by adding a front matter header (even if it's empty) and using Pebble to preprocess the assets. You can see an example here adding theme colors
    And here's an example of adding an image to the CSS as the background image: https://github.com/JavaEden/Orchid/blob/dev/themes/OrchidCopper/src/main/resources/assets/css/extraCss.scss#L47
    James Pittendreigh
    @jaymoid
    Hi, I followed on the tutorial page: https://orchid.netlify.com/wiki/learn/tutorials/your-first-orchid-site, noticed two things:
    if you follow the instructions you will get an error as src/orchid/resources does not exist. Also minor thing is that the orchid version is a 0.12 (which I think is a little out of date?!)
    I thought about editing the page, but seemed like it may be best to mention it first
    Casey Brooks
    @cjbrooks12
    Thanks for the heads-up, I'll go over it today and bring it up to date. All the example code in the repo should be up to date, however https://github.com/JavaEden/OrchidTutorials
    Casey Brooks
    @cjbrooks12
    @jaymoid I'm also seeing the src/orchid/resources not found error. I'm not sure what changed, but it definitely used to not crash. I've created #308 and will get this fixed shortly