Pattern Lab

I’ve been using both Roots and Bedrock for a while, and both of these projects have forced me to up my game in terms of how I go about designing, building and deploying websites for clients.

In the spirit of continuing to improve my workflow, I’ve recently started to experiment with and the associated atomic design system. Now I am wondering if anybody on here has any experiences of using Pattern Lab with Bootstrap and Roots.

If you have not tried Pattern Lab yet, check it out. I guarantee you will be impressed.


Hey there! did you get a chance to resolve your issue? I’m just about to begin using patternlab myself! :smile:

Yes, been using to great effect. Just set up a grunt file and include bootstrap, works a treat. If you have any questions leave them in this thread and I’ll try to help you out.

1 Like

Wow I can’t believe that was 25 days ago. I will try and get it working with Gulp, I’ve used gulp from the start, I’ve never tried my hands on grunt!
Just a question, how are you using Patternlab? Do you use it simply for the styleguide? Or have you set it up so that you are including in actual ‘bits’. I was playing around with a Jade port of patternlab I was making and I would use certain bits by adding them as mixins or includes. :smile:

We’re using Patternlab to build all the page templates. It saves loads of time and effort. No more full page mockups in photoshop or illustrator.

We’ve got it working with gulp now. Once you’ve got the pages designed in PL you can copy the assets (less, images, etc) into your sage theme. Copy the html in the generated PL files into your sage .php theme files, throw in some template tags and off you go.

Looking forward to trying out some of these other css frameworks soon.

@treb0r That sounds great man, do you have a gist of your gulpfile available? I’m going to do the same, I love the concept of atomic design.

As for other frameworks, I’m really enjoying using stylus with jeet and axis. Much leaner than using large frameworks :smile:

Here you go:

Here’s the modified Sage gulpfile.js and package.json that we are using with

We’ve added gulp-shell and run-sequence as you can see in the json.

Let me know how you get on. Any questions, post 'em here.

and by the way, stylus, jeet and axis all look way cool, thanks. Can’t wait to be free to try stuff outside of Bootstrap but still within Sage.

1 Like

I’ve almost got patternlab fully working, with stylus jeet and jade! All I need to understand is your folder structure. At the moment I dumped all the folders from patternlab into my theme directory.
The problem with this is that I don’t know how to access it from wordpress, because patternlab’s public output is simply a static site. The only way I can load it is by dragging the main html file into the browser, just so I can see what I am doing. This is probably more of a limitation of my understanding of wordpress and .htaccess.

I also changed:
var manifest = require('asset-builder')('.source/assets/manifest.json');
var manifest = require('asset-builder')('./assets/manifest.json');
because that’s where Sage keeps it by default and I wasn’t sure why you moved it. Perhaps to parse info/assets from patternlab?

You shouldn’t dump the Patternlab files into Sage.

I think trying to to use stylus, jeet and jade is also complicating matters. I’m waiting until Yeoman arrives before I try any of that stuff. I would just get Patternlab working with Bootstrap for now so you can learn how it works.

If you decide to have another go with Patternlab and Bootstrap you should clone a fresh copy of Sage and move it into your theme directory.

Then you can cherry pick the assets you need from Patternlab (Images, Less, JS).

Put those assets into the right places in the Sage assets folder. You should now be able to compile your assets for Sage with Gulp.

Once that is working you need to copy the html from Patternlab into the theme php templates as required.

1 Like

Thank you! That makes more sense, I thought you had just automated the entire thing. I appreciate your help and guidance thus far and will do as you recommended.

Regarding Bootstrap, I may give it another shot too, I just find it so bloated and messy to work with. Perhaps I need to learn cleaner ways of using bootstrap :smile:

It’s just a case of trying to run before you can walk.

Remember that the guys have already stated that they intend to unbundle Bootstrap from Sage using Yeoman.

If you can get Patternlab working with Bootstrap and Sage you will be in a great position to transition to whatever tools you like once that happens.

I’ve been doing a lot of reading about Jeet, Stylus and Axis. I’m looking forward to using them soon so thank you too.

Good luck :wink:

1 Like

Here are some more references for Jeet and Stylus :smile:



And if you like stylus, you’ll LOVE Jade (for non-wordpress sites):


1 Like

Hi Treb0r - this whole discourse is very interesting but I’m just having some issues with understanding the setup whereby I’d have bedrock, sage running with patter lab somewhere in that set up whereby my front end developers could work solely in pattern lab source folder (I’ve already cloned bootstrap sass in here and have pattern lab working with bootstrap - originally using compass) compiling into the public css (and perhaps being able to access using domain/app/patternlab/public/) and also into the sage assets css - so the set up here would make both css files the same and allow any changes made to pattern lab be mirrored in sage. I was thinking that I could use the sage gulpfile.js to achieve this mechanic and looking at the above discourse I thought that’s what you were doing but something doesn’t seem right. So just to recap …

The setup I have at the moment is …

– bedrock

So looking at your gist - so do you have patternlab files actually in the sage folder and your gulp file instructions are referring to this setup?

Hi @icandeveloper, sorry for the late reply.

We keep PattternLab and Sage separately. We have got our own gulpfile together for Patternlab that is based on the Sage gulpfile.

Templates live in Patternlab as that allows us to build up a library of reusable UI components and PL is handy for displaying the layouts to the client.

Once signed off, it’s just a matter of copying the assets (Sass, Bower.json, etc) into a fresh checkout of Sage. We then just copy and paste the html5 templates as needed to build the working theme. It’s not integrated, but it works well.

Hey, would you mind sharing how you set-up bootstrap with patternlab (node). Did you use bootstrap-sass? I am new to pattern lab and not sure how to setup bootstrap-sass correctly with it. Thanks

Hi @danmv

I work with @treb0r on WordPress sites built with Sage using PatternLab for the UI design. I use a hybrid of PatternLab with the front-end workflow of Sage 8.5. The Sage 9 webpack workflow still blows my mind at the moment :smiley:

Here is a brief explanation of how I use Bootstrap with PL.

First I pull bootstrap-sass via bower into a bower_components folder in the PL source folder.
My PL source folder uses the same /assets folder and file structure as Sage 8.5
Then I have similar gulpfile to the one used by Sage 8.5. This runs a sequence to compile the assets (.scss .js etc.) into a /dist folder using the rev manifest in the same way as Sage 8.5.

Make sure that manifest.json uses the correct paths to tell gulp where to compile the assets into PL
"paths": {
“source”: “source/assets/”,
“dist”: “public/dist/”

Once everything has compiled, the last event in the sequence is to run the pattern lab builder command using gulp-shell. I use the standard php twig edition of PatternLab so if you’re using the node edition the pattern lab build task will be different.

One other thing… as I’ve told gulp to compile the assets into /public/dist/ I need to link to the assets in /public/dist/ in Pattern Lab’s head template and data.json

I hope that helps. Give thanks!

1 Like

We are currently looking at a proper integration between Sage 9 and Patternlab 2.

There is an interesting WordPress theme using Patternlab twig templates here:

If we are successful we will release the project on Github.

1 Like

Any further on this, @treb0r?

Very keen to understand your approach!

It’s doing my head in, frankly :slight_smile:

I’m keen to understand this as well.

Instead of keeping patternlab separate and copying over compiled HTML files into their respective templates in the wordpress theme, I would like to see the process more integrated where PatternLab’s files were actually part of the theme (keeping everything DRYer).

I saw this article and it helped my understanding get a bit closer, but I’m not brave enough to try it while my current project’s deadline looms.

Looking forward to getting this cracked one day, I think it would be an awesome workflow!

PS are people using Axis and Jeet in 2018? I have never heard of them.

1 Like