image of man and laptop in office setting
Requires Login
Brightspot front-end training webinar

Looking to learn more about handlebars and front-end engineering using Brightspot? Start with this training, led by our world-class team of experts.

Click here to download a copy of the front-end training deck.




Welcome to the bright spot front end training.


What we're gonna do today is sort of go over how Front end works with Bright Spot here.


We've got just some quick overviews of the front end stack.


What we talk about when we talk about Front end, We're gonna get into a little bit about the roots style guide in the view system, style guide application.


And then that's kind of what we use for local development.


We'll talk about the front end bundle which is sort of our collection of front end code as it gets compiled and goes out to get hosted to serve the site.


And then we'll go over a little bit about each of the sort of languages in our stack that we deal with the most with handlebars for html and translating and our Templating language javascript, which is we use mostly for interactivity, at least in the out of the box bundle that comes with Bright Spot.


Talk a little bit about styling about less CS S and sort of how we do how we do that.


And then go over how we've got a lot of JSON in the front end bundle both for using JSON for examples of content and processing the site as well as we're using JSON for a lot of the configuration of the bundle itself and the style guide application.


So we'll go over through that and then in the end, we'll have a quick sort of code example.


with a quick little couple of like how tos of creating a new module or creating a style or an option of a of a module as well.


So, yeah, to get started, a little kind of sort of high level review.


So front and development here, it's kind of everything you'd think of as front and development in terms of, you know, working on html, working on templating cs S or javascript.


But also with bright spot, there are some additional controls that let front ends create views and sort of drive what data we need to show on the website.


And also we've got the ability to incorporate publishing features in bright spot.


We call those front end fields because the front end devs usually make them.


but that is a pretty powerful the thing that we have where it lets friend and developers add stylistic fields into bright spot that let editors choose things such as colors or background colors or iconography or other things that are, that are visual and have to do with the front end rather than the, the model data that they have to deal with.


And we'll go a little bit later into how, how that works and how we use that a lot.


So for our, for our friend stack, we've got Jason that we use for configuration for the views which talk about as well as for the style guide application for all of the examples that we have been there.


for html templating language, we use handlebars because all the like basic, all the data and everything that bright spot stores is JSON in the end.


So we use handlebars to transform that out to html.


We use L for our CS S preprocessor.


Now, there's no like hard coded reason to use less versus SAS or just plain CS S or really whatever you want here.


It's just what a lot of us were familiar with and that's what we've got out of the box.


All of our javascript is coded using ES six syntax and then we be able to transpire that to whatever we need to.


we use web pack for a module bundler and to sort of create chunks and whatever sort of optimization pattern you might need for your particular site and, and users yarn to deal with sort of the workflow.


And then we've used an app that we call the style guide to run the local style guide application and to let us develop quickly locally.


And we'll get into that also how that works.


So we're gonna start off by talking about the root style guide and this was sort of mentioned yesterday and talked about in the back end training.


But we use this the this root style guide to it's sort of the glue between the back end and the front end.


It's called the root style guide because it usually originally lives in the root.


But we've kind of relocated to the everything and that's front to the front end folder.


So, that's where it lives there.


What this root style guide does is it specifies the views which are a collection of fields and these fields are data that needs to be displayed on the site.


Each view requires a JSON file and a handlebar file, the handlebar file ends up being empty in that root style guide, but it's a renderer hook to that the back end uses and the JSON file creates the, I'm sorry, the, the data on file has all of the fields that you need to display that particular view.


And then the view E is automatically generated upon build time.


And this view results in a java interface that the back end need to implement.


what, what that means is basically the the back get told that hey, I need a certain fields of data that are in this view and then they have to implement those fields.


So we create that JSON schema and those fields as we as front end developers know what that's the data we need to show on the site.


And then the back end devs deal with the actual data modeling, they create the modules or content inside the C MS.


And then they create the view models that actually place that data on our contract is that JSON file is that's the view that's the data we need.


And then the back end of know that data they need to get to us.


And then how they do that is really kind of up to the business for that particular use case that module or that content type.


Most of the time that data comes from the C MS that data could come from some back end to backend api communication that it could be whatever.


So like normally the back end training is the the day after the front end.


So I got in here, you will learn about that tomorrow, but you sort of that we talked about that yesterday and really this, this is kind of a lot of times how we work in the sense that we can work independently where as long as we agree on this view, the front end knows what to show the back end knows the data they need to give us.


And we, as the front ends don't really care about how that, how we, how that data comes to be.


We just know that if we create an article page view.


And that article view has a headline, we just know that the headline is gonna end up being a string because we put, put a headline string into the into the JSON view.


And then we don't care whether the editor has to type that into the C MS, whether that's automatically provided from some feed that the back end I headline and the design has asked us to put a headline at the top of the article page.


So we can do that using handle bars to create the html and some CS S to show that.


So we can kind of, it's cool because we can work independently from the back end.


Because again, like they can deal deal with the modeling, we can deal with showing this kind of stuff.


And then that view is that contract that we say, hey back in, we need an article page headline and that goes in the article page view.


So the way that we develop this and the way that we kind of work front end des is we've got the style, a style guide application as we call it.


It's our node Js app.


And it runs locally and it processes the example json view files via our actual handlebar renders that we write.


And this simulates what's happening with C MS data entry and rendering on the web.


This uses the DEV environment of setting and web pack to compile our javascript and CS S and it uses the same exact code and build systems that the, that the real site is going to use.


But it allows us to work locally and then see our work instantly.


And because it is the same handlebars, it is the same cs S and javascript and we've got trust that the same code will work correctly once it's deployed.


So again, these we can create while we create this json view in the root style guy and that's the that contract, we sort of create examples of those JSON files in our bundle.


And then, so we say that, for example, for an article, we can put a headline in there, we can put some words in that headline and then using the style guide application that application runs and it actually processes that JSON using the same exact handle bar that the real site will and it again simulates the C MS runs locally, runs super fast.


So it allows us to basically do all of our work locally without having to, for example, run the build and push that build into a local version of running bright spot or uploading it up to a Q A environment or whatnot.


It allows us to, to work local and work super fast.


So this is primarily where we as front end devs.


this is primarily what we work with and what we work in.


when we developed the, the bundles locally.


So talking about the, the front end bundles, So we originally call this thing of a theme.


But the bundle is really the front end of the site.


The kind of calling it like theme has a lot of like connotations built into it.


So we figured bundle is a little bit more of a real world name for this and this is what we primarily work with is front end devs.


The bundle has all of the handlebars, all the javascript CS S as well as any like static or SVG assets that we might not want editors to have to control in the C MS, but that we might want just locally hard code in the bundle.


So maybe it's an SVG for a menu icon or something like that or like a lot of times, for example, we, we'd use scgs for site logos, but maybe we want a hard code one or something like that.


I don't even, I don't, I don't know, but whatever that, that are hard code assets facility that you don't want in the C MS, you could put those in the bundle as well as all of the JSON for all the view examples because that stuff can show up on the Q A environment so it can get looked at and all the JSON for the configuration because this bundle ends up interacting with the C MS in the sense that this has all the configuration files for those publishing front end fields that might show up in bright spot.


And it also has configure so those configuration files, all of that is in the bundle so that it, it'll interact with bright spot and actually add those fields into the publishing interface.


So we'll go through and talk about each of the bits of tech as far as like handlebar, Java scripts and have a few slides to dive slightly deeper into each one of these.


And then one of the, I forgot to mention this in the beginning, but there's a Q and A section in Zoom.


And if you guys have any questions about as I'm going over something, Please ask them there if they're like relevant to a particular slide that I'm on, I, I'll just like jump in and answer them.


And if they're a little bit more broad questions, I'll, I'll go into them at the, at the very end if we have any.


So talking about the kind of kind of three major pieces I will start with handlebars.


So that's really how we render html.


It's our templating language that we like because it, while it does, it's got a pretty good strong separation between template styles and javascript.


So it sort of lets us create it, it, it's, it doesn't have to put all your, you know, you don't have to use your javascript for rendering.


You can use this, especially because everything is in Json and Bright spot, it's logic less, but we found it to be a little bit too logic less in the sense that we've created a set of helpers that assist in composing of templates.


We've created some comparison helpers, some logical and math helpers.


And then if you need to do anything super complex in the front end, we, you can create your own helpers via javascript.


We've got some documentation around all the helpers that are in there.


I found the easiest way to access.


This is if you just Google for Bright Spot helpers, this page comes up and, and also this presentation well, is, is up online and, and so will this whole webinar so you can, you'll be able to click on these links also.


But again, if you Google Bright Spot helpers, this kind of comes up and then this, this describes all it is.


I'll go into a few of them here though and kind of call them out because we use them a lot and they're super helpful.


So we use equal, greater than less than and, or, or these comparison helpers are not in handlebars, but they're great for moving through item arrays with some logic.


A lot of times, you know, we found we like, I don't know, we might want to render the first item a little bit differently.


So we can do an equal of on an index if you're or things like that.


What we usually don't want to do is do comparison helpers to things that are like strings or whatnot because that can get pretty janky sometimes if you do that.


So really what we love for these is to move through item arrays.


We've got in, in bright spot every everything it has a template and there is a lot of parent and child relationships with templates.


And then we found sometimes that the Children may need some more additional data from the parents.


and passing that data through Children templates can be difficult.


So we've created a setter and getter system with some helpers that let you create essentially, we could call them global variables that can get set on parents.


And those are things that could get set, for example, at a very high level on a page template.


And then any child template that's rendered on that page has access to that variable.


So it could be something as dramatic as like a variable that could decide how a certain module renders itself or something as small as like an image size.


And I'll get into image sizing here in a minute.


But we use set and get a lot for, for this kind of stuff.


We've created an include helper that literally includes another template within a template and passes it the current context, we use this literally everywhere and this is something for template use.


And we'll get into some specific examples to show that.


But for example, we have a single helper that we've created to render an image or render a link.


So we don't have to do the same a a tr everywhere with alt or like image with alt tags and sizing and things like that.


So we created this helper where you can just use includes to support a lot of cut re reuse.


And then we have this render helper, which is this contextual rendering concept.


It sort of got superseded a little bit with this include, but it's still used in places.


And it's a powerful concept that allows us to render a specific style of a template and sort of pre choose that for the editors.


So for example, we might have a particular we, we call it the promo module, but it's a promotional module.


It has like a image, a text and a description and a link.


And it's for example, like some people call it a Hero module or or whatnot.


And there's a number of different styles, visual representations of what that could look like when we could have an image above some text.


So where it could have an image overlaid of some text.


And then we use this kind of render to sort of pre choose a version of that for the editors.


but then they can go in and override.


So for example, if you know in the, the f in the body of an like a of a section page or something like that, most of the time we want the editors to, to have a overlaid text on top of an image, we could sort of say that whenever you drop one of these modules, it automatically will sort of render like this unless an editor chooses to override it, which it's a tool just to make editing a little easier for editors.


And we have this also at helper that we use a lot for image sizing.


And it's the resize helper and this is a directive to receive a specifically sized image from DEMS which is our image sizing system.


And this is used a lot with a set and get helper to allow for code reuse and contextual image sizing.


So I'll show a couple examples of that as it's this is super useful.


So we've got a an image and an image tag, which is something that we use either via that include helper in places.


And this uses that resize helper to resize the image that it gets to a specific size.


And it uses the get helper to get the image size variable that might exist.


So this lets really everyone use this helper.


Oh I'm sorry, you, we use this handlebar file via the include H but set their own image size that they might need.


So for example, the recipe module wants a medium four by three image And it can set the image size variable to that.


And then they can render the image and which uses the image renderer.


And again, that code gets this is reused everywhere.


This image tag is coded once in a code base here.


And this but this will actually fetch a four by three image which is specified in an image configured file, which I'll talk about in a little bit later.


And it'll render that if you skip this image size set declaration, it would fall back to a large 16 by nine, which is sort of like a fallback default images just in case if you miss this image size in your modules.


So whether this is an article lead or a carousel or whatever, all of these guys can reuse this image tag helper and set their own image sizes to create to promote lots of code reuse and so promote some nice pat nice cleaning patterns throughout the code base.


So these are again just a few of the helpers, but I just wanted to call out some of the more wildly used ones.


But again, if you Google for bright spot helpers, you see them all and a description of how they work.


And again, there is a these helpers get run through actually javascript and his helpers at Js file that's in the it's in the training bundle that you can see that training bundle is publicly accessible.


And in there, you can see some examples of some like custom helpers.


And if you need to do something, you know, super custom, you can write it in javascript in there and actually have a custom helper written too if you need to.


so to get into next up javascript a lot of times or not, a lot of the times, but in our bundle that's out of the box.


We use javascript really for interactivity.


We use ex six written javascript.


It's a mixture of classes and custom elements.


Again, we use bubble to trans ple it into using browser list into whatever browsers we need to support and deal with poly fills and whatnot for other browsers that are, that are old.


And then we use we web pack to package our javascript into a combined javascript that can be loaded on every page as well as chunks.


that can either be dynamically loaded, you can manually load them on other page types, that sort of pattern is really up to you and your site.


And we don't try like we just offer up an out of the box sort of example and what we, you know what, what we chose for that, but you can take it's it's web pack.


So there's lots of plugins, lots of options and lots of availability to optimize that or deal with that however, you will.


And then, so we mostly use custom elements to bind javascript to the Dom.


And then we find that for most content driven sort of, I use it in air quotes really but static sites.


We don't really need a big javascript framework to just weigh down the site and sit there and, and there are no state or views to handle in sites like that.


This allows us to use javascript to make the site more interactive and enhance the html versus using it for the rendering since we're using handlebars to deal with the rendering.


You know, an example of that is something like our carousel javascript, that is a custom element.


And it's got a connect the call back.


In this particular example, we're using Flicky to deal with the actual carousel and sort of offload the workload of the carousel itself.


And you can see where this custom element is actually an async.


custom element.


It uses the weight syntax to dynamically look Flicky web pack will take this and chunk out the potentially heavy Flicky third party code into its own separate bundles.


And then just take this lightweight custom element that deals with essentially setting the carousel and dealing with some arrow repositioning if you because, you know, like for, for our bundle here, the arrows are, you know, halfway down the the slide.


And we might need to reposition them if you change your change your browser and add dots or whatnot to the carousel.


So in this case, this little bit of lightweight custom element code is compiled into the all dot Js and comes to every page.


And if a page happens to have this custom element, then it'll go off and dynamically load the third party Flicky code on that particular page.


So this is the kind of pattern that we use for a lot of our interactive javascript.


And again, we sort of find that we don't need a full javascript framework to run on top to deal with this kind of stuff for us.


That's not to say that we don't use these type of frameworks on sites all the time.


And especially when necessary.


But we find that a lot of times again, the site is content driven.


And then only a portion of the site is an application.


So in those cases, what we've for example, what I'm gonna use is like a scoring leader board on a sports site.


For example, we find that that scoring leader board is a very interactive application that has state it's got its own sort of views that it needs to deal with and it needs to dynamically sit there and hit a graph QL end point to get the scoring data and render itself.


So then we will, we can dynamically load, react for example, on that page, after that custom element loads and then that react that whole entire leaderboard can be essentially it's call it a leaderboard module on a page.


And that module is very interactive, very dynamic.


It sits then hits a graph QL endpoint, it does its own rendering.


But the page outside of it, including the editorially published modules as well as maybe in a side rail and the header and footer and all that stuff that's still gonna be statically rendered through handlebars and through, you know, custom elements and CS S.


So that's what we do most of the time.


But again, this is nothing in right spot is you know, sort of hard coded or pushed or has to be done a certain way.


So sort of this whole, this pattern that we follow could easily be switched to where, you know, the bundle, for example, maybe only deals with a static header and footer and then the whole content could come from javascript applications that are that, that use graph QL.


There's nothing preventing a site from doing that.


If it, if it needs to.


So now to talk a little bit about styling and CS S, we've used less as a CS S preprocessor again, that's sort of the out of box a bundle and there's nothing preventing someone from you know, converting to SAS or just, you know, starting over, if there, especially if it's a custom design where it might not use the same HTML and CS S that we do in our out of the box bundle, you'd more than likely be deleting all the CS S and styles anyway.


So the only thing that makes less work is the fact that we use the less plug in for web pack to process less.


You could use any CS S preprocessors that you'd like.


But out of the box bundle, we use the BEM style syntax for class and element naming versus using a full object oriented CS S framework such as like Tailwind or something like that.


We, we found that for us that CS S changes and bug fixes are a little bit less likely to create regression issues with something like the BEM style syntax.


And we found that it allows multiple developers to work together a little bit more easily as you don't have this like waterfall style thing where some developers are working on the OO CS S framework and then some are and just implementing it and then sort of waiting and can't make changes to CS S because it might impact lots of other stuff down the line.


So we in the out of the box bundle, we use descriptive names for modules and components and then use that sort of ben style syntax to name their elements.


We do use a little bit of object oriented CS S but most of the time we use less to abstract certain styles.


It allows us to use less extended mix ins sort of depending on the use case.


So one example for that is where we use, we've got AAA page list in our world.


A list is a very generic type of module that can have many different styles or visual representations.


So list is just a list of promotional elements.


So whether that is a list of big visually big promos at the top of the page that might swipe across or contain a little carousel of four promos or it's a module that contains, you know, 10 10 little grids or 12 grids of of promos or something like that.


Those are just different visual representations of the same list content type.


So we created this like object oriented style list, putter and items and sort of some like next load more type navigation that uses the page list, sort of naming scheme and then each individual version of that list.


We've got for example, page list that standard A and what as far as the naming you'll notice in the in out of the box bundle and training bundle.


We got, we don't have a very descriptive names for these just because we just call them like a through whatever.


And then there are in the configuration files, there's the ability to do to give display names where we could give editors a little bit more descriptive names for these things.


But we've found in the past that naming things is actually way more difficult than we thought because like everybody has an opinion on how something is named.


So we just went with the generic A through Z naming of lists.


And then again, we could give, if the editor team, editorial team wants a certain visual name, we can give that to him via the display name.


But again, we like page with standard A has that will have a html name with class that way.


And then, we found that this sort of pattern allows us to create some very like broad level styles for the generic sort of page list, which is sort of the parent and then each individual list can have its own styles.


And this way, as a developer, you sort of know a little bit more what you're working on when you're working on it.


And then you can also sort of see your CS S bugs and see what you're working on.


And if you get asked to make a change to the standard list, a spacing, when you do that here, you'll know a little bit more exactly what you're working on.


And you'll be able to make that change with CS S rather than like utility classes.


And then that way, it's a little bit more potentially targeted to what you're doing and you won't impact other developers or cause regression issues.


So that's why we went that way.


We use four variables.


We decided to use CS S bars and less variables.


kind of intertwined where we use CS S BARS to set values, whether they're set in a CS S or in line html.


And CS S bars allow us to create a nice pattern where we can set CS S variables through C MS editorial fields to allow editors to customize whether it's the modules or the whole site.


We use less for variables for places where variables are helpful for developers.


But editorial overrides aren't necessary.


So to show what I mean by this is for example, for something as global as colors, we've created a we created a set of editorial fields using configuration files that lets developers.


I'm sorry, editor, editors control the colors of the site.


So the editors get a set of editorial fields, we as front end developers created where they can create the primary color, the text color, the site background or a border color, the generic bo border color.


And the editors can control all of these colors using those values that come from the editors.


We set, you know, root based CS S variables for ourselves.


And then we use these variables in directly in our CS S so that you know, for the page header background, we use the color header background CS S BAR.


So this allows us to create a pattern where the editors actually have control of the background header color.


And then we create a fallback for ourselves That if the editor does not set that color in the, the theme or a theme version of that themed version of that color for themselves, we fall back to a white background header color for ourselves.


So we've kind of created this sort of pattern and that's CS S variables allow us that sort of pattern because you can set those CS S bars at the root.


And then later on, you can use them in all of your CS S.


So that's, it's pretty great.


We use that a lot for whether that is used for something like this where we set in the root.


But then a lot of times we use that on modular level where if a module has a certain background color, we could also give the editor the control to create a background color on a particular module.


And then we can create an in line tag at that top html wrapper of that module to, to, for example, reset, maybe a variable or for example, you could reset if a module is gonna have a certain text color, we can set a primary text color in CS S for the, for the site and for certain elements.


And then for a particular module, we could give an editor the ability to override that a text color for that module with something else.


And then we can do something as simple as resetting this variable with an in line style tag.


And then all of those Children will get that, that same CS S will just be reused, but the CS S variable will change creating a nice pretty pattern.


So we use that a lot.


So now, you know, let's get into a little bit into JSON.


And we've got that sort of everywhere throughout the bundle.


We use this for the view examples that I talked about a little bit as well as configuration of the style guide application itself as well as configuration of how the bundle is gonna interact with bright spot.


So these JSON example files that we used, they're used in the front end bundle to simulate how the C MS was going to fill out the views.


This allows us to create ourselves local examples of content type as well as like full entire pages locally.


So when we run this local style guide, we can then see this JSON transformed using our real handlebars, JJ S and CS s and, and show that locally.


So what I mean by that is you can see in the training bundle no A, we've got a article page.


And then if you go into the root style guide, you can see the data, then the contract that we set up with the back end and on what an article page has in terms of content.


And then in terms of fields and then in the bundle itself, we're gonna create an example file for an article page.


And then when we run the style guide application, it will render an article page using the same article page H BS that it would on the live site using all of this sort of test data that we created for that we input here for ourselves.


So we're essentially sort of simulating the C MS by creating these files.


And again, sort of, instead of having to run the C MS application like instead of running Bright spot locally or running bright spot on some Q A server working with our code, having to then fully bundle it.


We can instead do this run the style guide app and see our changes instantly.


So as well as you can make these example files locally manually.


But also since every page is every page in bright spot is just JSON.


You can use a underscore renderer directive and the queer string.


And this will show you the Jong that is behind a particular page and you can copy and paste this stuff into your style guide.


If you want to use examples that have been you know, that are from a pre existing site or something like that.


Or if you have your editors that created some, you could you know, use this because it's got the promo, it's got the description in here and it's got an image that's been uploaded to the C MS with a path on CD N.


So you could get a title so you could use this.


But what we like to do a lot of times is create these examples manually.


because we've got some word generation, word generation and data generation helpers that are created that allow us to create some data that's like basically fake la and s some style data that can stress test our design and our and our html a little bit.


So for example, in this article page, you'll see that like we use a generic date here and then the headline and sub headline.


we use the words helper And then that drops out between five and 15 random words for the headline.


So this, it lets us create some laum s some style examples in our local style guide.


And that will again, sort of stress test because every time you refresh your page, you're gonna get a headline between five and 15 words.


So you could put 50 words in here.


And then you could see that maybe sometimes like here's what my page would look over the five and I'll refresh and see what it looks like with 50.


So this way, it's a little bit versus using some hard coded words and then, you know, hey, five words work great in this design.


But if I put 50 it breaks the design, This will kind of let you pull out these like the these edge cases using these sort of data generators.


So, also if wi with these data, data generators, and the local style guide, if you don't specify the actual source of an image, we will generate an image for you a gene image with a, with a placeholder for you with the exact size that the resize helper would normally get from the C MS.


So it lets you get sort of realistic also image sizing.


So all that is built into the style guide application.


So we've also got Jason config files throughout the the style guide, I'm sorry, throughout the bundle.


And these are the config files which impact the way that the bundle interacts with bright spot as well as the Style Guide app.


So we're gonna talk a little bit about some of the config options here.


But these configuration file contains all the image size options.


All these additional fields that the front end can add into the C MS.


Because then once the bundle is pushed out into the C MS, that's how you know the editorial interface can run in fields in from the bundle.


It has all the style guide, the style variations of the content types so that the, that those are given to editors as options to choose from.


And then they config files are defined at the root of the style guide.


or in subdirectories, we try to encourage people to sort of place them in the subdirectories where they where they make sense.


And really run time, all of these configuration files are actually combined into one genre config file.


We orig originally had this as just one giant config file.


But it got to be a, just a giant mess of merge conflicts.


So that's why we split it up into just like we call I just kind of call it stardoc config dot JSON and they're, they're all over the the bundle.


But again, they just get kind of compiled into one big config.


So one specific call out is the JSON configuration for image sizing.


These images image sizes are defined in this configuration file.


And then once defined, they can be used with the resize helper to request those images.


So in the training bundle, for example, we've got this image sizes, config dot JSON which is in the root of the base of the style guide folder in the bundle.


And this has all of the image sizes that modules can use and can act, can ask and they have width and height definitions that are then fed over to Dems and Dems will return that size.


We also have the ability to specify instead of just a, a specific with an height, if you need more of a variable image aspect ratio, We also have the ability to provide something like a maximum height or create something that maybe has a hard coded width but does not have a site height specified and then you'll get a 1440 wide image.


and then it'll use the aspect ratio of the source image that's been uploaded to create a variable height image.


So for example, it's an image size like this is very useful.


And so maybe something like a car like a whole full page modal overlay carousel where you might wanna fix a, a particular height, but you might wanna show portrait or landscape images.


In those particular iterations we use, you will see this like preview height or preview with.


And then this value is actually gonna be used by the style guide application because when it's generating that image in the style guide application locally for you, it kind of needs to know an example image to provide for you.


So it'll provide a 600 by 1440 image here in the root style guide.


And then another call out for a particular config files is for these front end fields.


So these are the additional fields that are added to the styles tab in the C MS that allow editors control over certain styles of content types.


So these fields only persist for this particular front end bundle and they're not part of the content types data.


And that's a super important call out because these should not be used for data for that content type, but they should be used for additional styling options.


So we really like to use these things for something like background color or image alignments.


But really don't want to use these for like text because usually something like text might belong in a modeled field.


So for example, in a article, you'll have we have a field called article lead style.


And that has a style type where we have a standard lead or a large lead with a big image or an overlay where the headline is on top of a big old image or maybe a nested lead where it's in the content type.


And this is a great example of a front end field because it's purely visual, it uses all the same data from the article page, but it has, it allows you to, allows the editor to visually change what an article might look like but not actually add data or something like animate on scroll, like you might wanna animate this module on scroll, yes or no as an editor.


That's a great front end field because it's got nothing to do with the data, but it's a very visual kind of kind of thing.


And when you add these fields to particular content types, you add it to that particular modules, config dot JSON in a fields tab I'm sorry in the fields key.


And this is a great example too where you know, p promo module A is a certain type of a certain look of a page for emotional module.


And it has a bunch of fields that we add where you can hide the category or you can show the B line or it lets the editors change the text alignment, the background color or inverse the color of the, the, the text in that module.


And these are all fields that the editors can control for this particular iteration of this module.


And these fields they can make the these fields are independent of the content.


And they only persist for the in this instance of this module in this bundle.


So that's again, super important that we don't, we don't put like modular data into these fields.


But it, but use them for visual display.


And then the last kind of call out here is the JSON configuration for the styles of these content types.


So this page list or page promo module are perfect examples of that.


And this is what I was talking about where it's the concept that lets us create many different looks of a content type in the same data schema.


So something like a page list or page promo module is a content type that is used to assemble lots of pages like a home page.


So if you go to a just like the like a home page, you know a module like this is this module on this module or oops, sorry, I click on that.


But like this module is a promo type module where it has an image, it texts a description and a link.


This kind of module is you know the same exact thing as this guy with some editorial options.


And these can take many different looks and feels.


for example, if you had a module here where this text was actually this had a little bit of a background and this was overlaid on top of this.


It's still the same data schema and it's still the same page promo module.


But we call it a different style of the page promo module and we create different handlebars for it, different CS S for it and then we put it in this configuration file.


And then this is what gives the editor the choice to when they create that page promo module and they input that data for it, they get to choose which style of the rendering they choose.


So in this training bundle, we've got the A B and C iterations of this page promo module.


And then the editors these examples in here are the examples that we made in that bundle that the style guide application can run and we can check these in our local stuff guide, but also at build time, the sys the build system pulls up these examples, takes little screenshots of them and then gives them to the editor.


So when they put in page promo, a page promo module on a page, they get a little visual picker that has little screenshots of the examples for them.


So they can choose which visual display of that module they want to show for that particular instance on that particular page.


And then they can go in and you know, modify this one further.


Because for example, I, I don't remember exactly now, like which one A versus B, but I think A is the one that has the image above the text.


And I think B is the overlays.


Yeah, the B is the overlay style.


So for example, this particular one is page promo module A with maybe the default alignment, whereas this one is same exact module, but the editors chose to do the horizon horizontal alignment of image left versus image, right.


So it can be the same module with the front end field to change the display.


Or if you didn't want the editors to have to go through that extra step, you could create two different styles of page promo module.


One that is automatically aligned left and one is automatically aligned right.


And then the editors get to choose that via screenshot versus having to choose one that had horizontal alignment and then having to choose a drop down to choose left or right.


So depending on your use case and how many editors, how many modules you've got lots of options to how to arrange these configuration files for different styles as well as different options and fields within each style.


So having gone through all of this, I wanted to go through a couple of code examples real quick.


And the two good examples that I have.


the first one is really kind of creating a whole new content type.


And then the second one shows making a new style of an existing module that already has an existing content type, but just making a new look and feel of that particular module.


So for the first code example is creating a whole new front end.


So, you know, in our out of the box site, we don't have something like recipes or meals or ingredients or whatnot.


So if we were asked to create a new content type for a recipe page and a recipe module, to kind of start out, we'd have to work with those, the back end team as well as the product team to really determine what the heck a recipe page and a recipe module look like.


And we, we're usually given a design and then, you know, the the designers create this and then we work with product and back end to sort of to model this out or nothing really model this out.


But we as friend and developers talk about what the view and what the data that we need.


So this, we create in that root style guide folder, a recipe page and a recipe module.


And then this establishes that content between contract between the front end and back end, it's placed in their roots style guide.


And then once that is done.


We can then as front end developers go off and work because we have the contract.


So this is something that, you know, we talked about yesterday in the back end training also.


But like we create our, you know, recipe folder and we create a recipe article page JSON as well as a recipe module, JSON.


And these are the fields that a recipe article page is gonna be need to show itself.


It's a sort of creative work page which takes care of a lot of the other fields such as the fact that it's gonna need a headline and a title and like metadata and all the header and footer and all those, all those kind of fields.


And then, but aside from that, you know, it's gonna need a lead, it's gonna need an article body itself because there's you're gonna describe and talk about the recipe.


And then it's gonna have the recipe itself, which is actually gonna be a recipe module.


And then we're also gonna then create the view for the recipe module.


And, you know, based on a certain design for what a recipe module might look like, It's gonna have, you know, these fields, it's gonna have a title and image difficulty, prep time, et cetera, et cetera and it's gonna have some ingredients and directions which will just be RT ES that the editors can fill out.


If you wanted to get like, for example, based on a design, you might have you might create a bunch of steps here or something else like that.


But, you know, in our case, we don't need to.


But once we have this recipe module, page and recipe article page, we can then get started on the front end because we can take these JSON files, we can create examples for them in our bundle.


And then we can start developing on them totally separate from the back end, who's gonna work inside the C MS.


So, you know, our, our step one for that is to create in this default bundle in the recipe folder.


We're gonna create an example article page for ourselves as well as an example module for ourselves and what these look like are the article page.


It's basically AAA an an actual article page.


So we can just kind of reuse an article page.


And then the article body is just gonna be a short couple paragraphs that are gonna describe the recipe and the recipe will just be the recipe module.


And we again use that include syntax.


So we don't have to copy and paste the whole thing.


And then the recipe module will use these words helpers to create a generic title.


We'll use the image to include an image to create some sort of generic image.


And we'll put in some basic strings for ourselves that we can use in the local style guide.


When the local style guide is run as well as some this kind of simulates some html coming out of the RT E and the directions are a simulated couple of paragraphs.


And when we put this in here and run the style guide, and sorry, and then we're gonna do some handlebars on top of that.


So rest it, we'll just get into the recipe module instead of showing the whole rest of the page.


But you know, we'll create the, the HTML for it will drop the title, all those fields in there.


We wanna set a medium four by three image using the image size, getter and setter.


And then we'll drop in some ingredients and directions using this HTML and then whenever the local style guide application is run, that will run and I've just got it running already here in the terminal.


And then that once that application runs it pulls up, you can pull that up locally.


Sorry, let me switch to the branch that has that and run the style guide look real real quick.


put them here.


So this is the style guide application running here locally.


And then when I've got that, I can then render this recipe page here.


It is running inside the style guide application with like that left hand menu or I can just run this, you can open these up as a new page, so you can run this recipe article page which has the recipe module here.


And these are the examples that I example text that I put in for myself.


And this is using the exact same.


And actually, if I just I'm sorry, let me pull up a little ID E here.


And this right here is using this this is the training repo pulled up.


This is the recipe.


Where are we at recipe page which is including the recipe module, the recipe module has all of this example content and then I can change all of these here instantly.


I can say sorry, here we go.


I can save that and then I can pull all of that up and I can refresh this page and I can see my changes here instantly and that way I can develop, I can change use cases.


But furthermore, with the style guide application running, the when I change the HTML and I make a change to it and I refresh this page, I can instantly see the changes to my html without having to build without having to do anything.


And the local style application is also running Watchers so that when I change something like CS S, So I've got my recipe module here.


And if I make changes to my CS S in, it will automatically it's got a watcher, it compiles it here when I make my changes.


So then I can instantly see my changes locally.


And this is using the same and this is kind of where the local style guide comes in.


And it's really powerful because this is running the same CS S as the bundle will on the live site.


It is using the same exact HTH BS renderer that the live site will.


So I've got confidence that the handlebar and the CS S changes that I'm making here are going to be represented real on the live site.


So I can do the, you know, 100% of my development here locally.


And then I only need to upload, run a local instance of the C MS or push this out to a Q A instance of bright spot just to basically double check and verify that everything is still working properly.


But I've got really great confidence that I can work and do my friend work independently of the back end because while the back end is modeling this recipe module in the back end and actually creating all these fields for the editors, I don't need to wait for the back end to make all these fields because I have that contract, which was that style guide that set all these fields.


So I know that the back end is giving me a difficulty field, that's a string.


And I can confidently use that in my handlebar file, knowing that I will get the difficulty from the back end as a string.


So that's sort of the pattern that we follow for making new content for making a for editing existing content.


Let me switch over to this branch real quick that has this new list style in it.


So, for example, in this particular code example, we've been asked to make a new style of, of a list.


So if I run the style guide application here and I pull up you know, local host, we've got a number of standard.


So a list is style A has a list where the first item is bigger with some smaller B has a grid whereas C or like D has a, it's list items are presented this way.


So these are all the same data type But they have different visual representations.


So this is what we get to ask a lot is hey, we need a different, another visual represented.


Another visual representation of a list added because designing wanted to create a new one.


So when we, when we get asked to do that.


Let me pull up just this pull request that we have against the training repo that has the commits.


So I can just go through each of these commits of how we do that work.


So, you know, to, to start off with that, we'll make a, a new list and, you know, we, we had him up to also we'll make a new list called M here.


And then we'll make a new example of this.


So we'll say that this is standard list M.


It uses the standard list M style template.


But the template key is still list because that's the content type that it is.


And it has an, a separate title but then it gets, you know, nine items which are promo items.


So this kind of is a instance example of what this would look like.


But it's modeled off the page list view that is in the root style guide.


So we create this example for ourselves and then we're gonna want to create the html for ourselves like and then when we create a simple, like, you know, if there's no items because an editor didn't add it, the list won't even render itself.


But it's a standard list M and then it creates a couple of wrapper Ds.


And then it uses, it says that it based on the design, for example, that if you're this is where we use those like helpers that, you know, with the first item.


we're gonna want to set a larger image size and render a standard page promo inside of it.


But otherwise, if the items are, the rest of the items will get some smaller promos, so we can write the html for this particular list in this standard list and handlebar file.


Then on top of that sort of the next step, once we create that html, we're gonna update the configuration file with the style option.


So we already have that page list.


Config Let me just show the full file here and this one has all the lists like a through L right now.


And then what?


We're gonna make a new one here at the bottom and for that new one, it'll use that example that we created as the screenshot in the C MS.


But it also is gonna give the editors a couple extra fields that this is something usually that product or design asks for where it might be a background color or it might let the editors, you know, inverse the colors.


If they add a black background, they're gonna want some white text.


So we create this add this now and now sort of once it's in the configuration file here, it's an official style that the editors can choose when they create the standard list.


and in the in the C MS.


So the next step is, you know, us adding some CS S to this.


It's what we just created some very straightforward standard CS S that's going to just show this thing as a grid.


And, and break points.


You know, we might just show different, you know, like two columns and a medium break 0.4 columns and a larger break point, you know, very straightforward, kind of, kind of simple CS S and for this example, but I need more complicated for you.


And then we're gonna update the style guide to show that new style.


We will have a, we have this navigation config which is what controls this left side of this style guide.


So here, we're gonna add this guy here on the navigation so that it's down here to be looked at and, and Q A and evaluated by and, and checked out by our like, you know, developers just to make sure that this matches the design we've been given.


And then lastly, you know, we can sh I, I'd show here like, you know, making a CS S update.


And how like that is going to that you can say that, you know, maybe for the first not the first promo, I want a smaller title.


than the other promos have.


So the, the CS in the CS S the title text is a little smaller.


But you can, then I've got the style guide running here locally.


So I can see this example.


I can see, you know, all that, the example text that I chose and I can see that this sort of matches the design that I chose where like when you're in a, a smaller breakpoint, it shows them all.


When you move to a medium break point, it shows two columns here.


And if you're in a larger break point, it shows four columns here.


And again, I can, this is all styles and code that I've created and I can mess with here.


And again, I can do this stuff locally.


I can see my changes instantly because when I change the CS S, this goes ahead and changes it instantly in the style guide.


So I don't have to like sit there and upload this to the local C MS.


And then also I can see, I can double check my example, Jason, so that when I look at this page list, standard M example that I created for myself here.


If I want to change this around and like, you know, what will this look like with five page promos in it?


I can change that I can see that and I can see it instantly this also because this is the same json and the same sort of pattern that's in the CM SS if I created front end fields.


So for example, in this page list config file, I in the standard M, I allow the editor to change the background color or inverse the colors.


I can also simulate the editor doing that.


And that now JSON gets fed to this example.


And then this is what this module is gonna look like if the editor chooses a background color red or maybe inverse colors.


Let me double check inverse colors here.


I can then go into the fields.


Config and inverse colors is a boolean here to change primary text color to the primary inverse colors.


So I can inverse.


So it's a boolean so I can set that to true and then that'll set all the colors so I can simulate that the editor here is messing with these settings.


I can simulate the editor messing with these settings and make sure that all of these settings and my handlebar file is reacting to these settings correctly.


So I can do all that locally, I can do all that super fast and I can verify that all my code is running.


So this is again sort of showing this example showing the style guide application running.


And as front end developers, like I said, we don't really have to jump that much into the local C MS instance, except for testing to make sure that all your code is working.


Because instead we've got this local style guide application and all these examples that do all of this for you.


And that's again, pri like to kind of circle back, that's primarily as friend developers, what we work with hair bright spot.


So we've had a, there's a question in the Q and A about something for back end as community develop, developed and bright foot approved items during the back end training yesterday, is their equivalent for front end commonly essentially like commonly needed already made content types or do they usually contain front and back end elements?


So there really isn't anything like that beca and that's for front end and really for front end, every instance of a site is essentially unique on the front end, right?


Because the CS S the styling, the HTML is super different per instance.


So while we have sort of out of the box bundles that get put out, most customers change the heck out of those and those things diverge super far from each other.


So really, yeah, we don't really have concept like a concept like that for front end at all.


And again, that's it.


something also like none of the front end here, none of the html.


None of these patterns, none of the CS S none of the javascript, none of that is prescribed by a bright spot in the sense that it has to be used this way or that the CS has, has to be written this way or the Js.


So for example, I talked a little how we use out of the box bundle.


And in the training bundle, you know, we've got object, we, we don't really use object or the CS S or something like a tail and CS S library with OO CS S class designations for, for things like grids or sizing or, or colors or gaps or whatever.


And that's not to say you can't use that at all.


Like it would be honestly fairly straightforward to re to pull the CS S out of the bundle and then change the html of and pull in some like a tail wind library, change all the html classes around to use that and move to that pattern instead.


So really like we don't, we don't really have that done again.


This is sort of the example in out of the box because we found that sometimes is actually even it is harder to work with than this sort of be favored bem kind of pattern of approach of CS S but customers can do that and you're free to do that.


And so you're free to sort of take the front end and just like move every which way as you need to.


So that's kind of what I've got for the whole front end sort of training and the overview.


And then just to have a little call out at the end of April, there is the Bright spot user conference in Reston.


And then it's got the Hyatt Regency.


And we're gonna have two days of sort of, of, of insights and connections with the bright spot community you in then like during that conference, you can get a glimpse at the product roadmap, hear from analysts and customers on digital experiences and sort of dive a little bit deeper into developer focused topics about A I some of the right API S that are out there.


And there will be some roundtable topics in there.


The agenda as well as registration for the free user conference is on the bright spot website.


So check that out and we hope to see you there.


And thanks so much for attending the front end training.


And as I kind of said earlier, we're gonna have I, I think Jill actually, if you can correct me if I'm wrong, I think there's a questionnaire that goes out.


And then also, there's gonna be the training materials, the link to this webinar as well as this presentation, which has all of the links to the the tr that training repo, which is again, it's a perfect github perfect sense training is out there and that's public and you can take a look at all those and, and load that, run the style gad application locally and all that and run those good examples as well.


Thanks for your time, everyone.

Get in touch

Ready to upgrade? Get answers to all your questions, guidance on when you should upgrade, and more by contacting your customer success representative.

Email our Support Team Now