Friday, April 26, 2024
HomeCSSFast Command Line Tip: Create Mutliple Recordsdata With the Similar Extension

Fast Command Line Tip: Create Mutliple Recordsdata With the Similar Extension


Should you’re accustomed to the command line, you’ll most likely already know you’ll be able to create a brand new file utilizing the contact command. For instance, this command will create a brand new index.html file in your present listing:

contact index.html

How about creating a number of information? Certain, we will do this multi function command:

contact index.html types.css index.js

On the subject of a number of information with the identical extension then certain, we may use the above technique. However what about if you wish to create 10, 20, 100 or extra information? That might get somewhat tedious.

In my present workflow, I take advantage of Nunjucks as a templating language, and I sometimes work with tens and even tons of of elements in template partials. As a part of our growth planning course of at Atomic Smash, we wish to create these information upfront, earlier than growth begins in earnest. That is in order that a number of builders can work on the venture concurrently utilizing the identical file naming conventions, and including feedback into the part information to plan the information that should feed into them.

If you want to create a number of information with the identical extension, then the next line of code positively accelerates that course of. Simply change the content material contained in the curly brackets along with your comma-separated record of file names, and the .njk extension along with your desired file extension:

contact {hero,lightbox,type,another-component}.njk

This command creates the next Nunjucks information:

hero.njk
lightbox.njk
type.njk
another-component.njk

I hope this protects you a little bit of time prefer it does for me!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments