Enable Javascript

Please enable Javascript to view website properly

Toll Free 1800 889 7020

Looking for an Expert Development Team? Take two weeks Trial! Try Now

Magento Pro Tip: Speed Up Content Deployment within Magento 2

Content Deployment - Magento 2

This post is about speeding up content deployment inside Magento 2. You can hire Magento developers who can assist you in this subject and get you the relative output. In this post, we will share some pro tips that will help your development team to achieve the target.

With experience in Magento 1.x, the transition to Magento 2 will carry more familiarities. The admin area still has all of the main components. You can also jump into the templating system and almost continue where you left off.

Something new that front-end developers will find challenging is how you interact with your static files, specifically CSS. When you want to make edits you need to deploy your content. For front-end developers, there will be a steep learning curve if you are not used to using the console. With Magento 2, the Magento console will be a regular part of your workflow. From the start, it will seem frustrating. You may not understand why but this is an opportunity to grow as developers and learn the new version of one of the world's largest e-commerce platforms.

We start with this command: magento setup:static-content:deploy

This command takes all of your “static” files that can be cached (CSS, Images, fewer files) from the theme folder and places them in the pub/static folder. To use this command simply, follow the steps below.

To deploy static view files:

This is a great improvement over Magento 1.x. This allows for faster file access and has a built-in CSS preprocessor. Once front-end developers get over this learning curve, they will grow to appreciate its benefits.

Once you run the command, you will see this deployment in action. Each theme will show its progressional steps as highlighted by periods. Once it’s done, you will see it move on to the next theme. However, most stores only have one theme, and redeployment of unchanged content is pointless. While this is a topic for future Magento 2 core developers to fix, we as problem-solving developers need a solution now.

The solution is simple. We delete the themes we don’t use. We do this with the following command:

Magento theme: uninstall --backup-code -c|--clear-static-content [your theme path] what this code snippet does is this:

As you can see, the command is very thorough. Now you will have one less unused theme to compile thus, speeding up your deployment and your overall deployment. Efficiency is key in development. Small amounts of time add up quickly when your goal is to get the site launched.

Run the Magento setup:static-content:deploy command again, and you will see that only your custom theme deploys.

As Magento 2 evolves, I understand this is a topic that will be solved for future efficiency. But for now, we have our workaround.

James Warner, the author of this post, has shared pro tips to speed up content deployment within Magento 2. You can share this post with your hire Magento developers team and help them in completing their project with grace. You can even ask questions related to Magento development from professionals.

Recent Blogs

Categories

NSS Note
Some of our clients
team