Thursday, January 2, 2020

Sitecore SXA CLI tips & tricks

I've been working with SXA themes recently and came across this great blog post by Serge van den Oever on creating a custom theme for SXA using SXA CLI and wanted to share a few extra tips on top of it.

NodeJS version
SXA CLI (specifically, Gulp 3.9.1) does not play well with Node version > 11 (the latest is 13) and will fail with "ReferenceError: primordials is not defined" error. One way of fixing it is using Node Version Switcher, but there is also a little trick I found on StackOverflow. You just need to create a npm-shrinkwrap.json file containing this:
{
  "dependencies": {
    "graceful-fs": {
      "version": "4.2.2"
    }
  }
}
before running NPM install.

Initial build & deploy
If you run standard "gulp default" task after the fresh checkout and you've excluded .css files from GIT - the task will silently fail to upload optimized style sheets.But there are few built-in commands that help you fix it - just run "gulp sassComponents" and "gulp sassStyles" before "gulp default" and SXA CLI will pre-generate .css for all .scss components.

Hope this helps you get started with the tool. I will update the post with additional hints, you're welcome to share yours in the comments!

12 comments:

  1. Thanks for your post, it guided me into the right direction! I have put a lot of effort into implementing a good way of working using the Sitecore SXA CLI. I published the results on Github at https://github.com/macaw-interactive/SXACLI-enhancements. Let me know if anything is missing.

    ReplyDelete
  2. very interesting, good job and thanks for sharing such a good blog. Seo Services Delhi

    ReplyDelete
  3. Really amazing information, thanks for sharing this valuable information with us. Visit Ogen Infosystem for the best website designing services and PPC Services at an affordable price.
    Web Designing Company

    ReplyDelete
  4. Great Article, If you want more information about Sitecore Training read this article.

    ReplyDelete

  5. Trusted Digital Marketing Company in Delhi
    Are you planning to market your business online and looking for a digital marketing company in Delhi? Visit Techdost.com and grab the opportunity to get a discount on Digital Marketing Services in Meerut.
    We are an organised, trustworthy and reliable digital marketing agency providing high-quality and cost-effective digital marketing services in Delhi and all over India.
    Digital Marketing Company in Delhi
    Attention! Business owners get website designing services for your business! From Meerut to any other state get website designing services contact website designing company in Ghaziabad. You will get the best deals and pricing at Techdost.com. Click the link to get the information regarding Website Designing Services.
    Social Media Marketing Expert in Meerut
    Android App Developer in Meerut

    ReplyDelete
  6. I definitely enjoy every little bit of it and It is a great website. I want to thank you for the content. I learn a lot from your blog. Good job! You guys do a great blog and have some great content. Keep up the good work.

    best crm software in india

    ReplyDelete
  7. Nice blog. I look forward to reading more of your content in the future and continuing to learn from your expertise. Keep up the great work!" CCSP Course

    ReplyDelete