Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8579283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:34:46+00:00 2026-06-11T20:34:46+00:00

I am using handlebars.js to render client-side templates (using Jade on the node.js server-side)

  • 0

I am using handlebars.js to render client-side templates (using Jade on the node.js server-side) for our single-page app.

I want to precompile the handlebars templates on the server side and bundle them up as one JS file to send to the client.

Currently, I use handlebars to compile templates like so:

$ handlebars template1.handlebars template2.handlebars -f precompiled_templates.js

I’d like to write a bash script that can read all the *.handlebars files in a directory and then run them through the handlebars compiler. So, if I had a directory like so:

templates/
  temp1.handlebars
  temp2.handlebars
  temp3.handlebars
  temp4.handlebars

Running my bash script (or, one line command) in the templates directory would essentially run the following handlebars command:

$ handlebars temp1.handlebars temp2.handlebars temp3.handlebars temp4.handlebars -f precompiled_templates.js

Does anyone know how I could write a bash script to get all the handlebars files in a directory onto the command line like above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:34:47+00:00Added an answer on June 11, 2026 at 8:34 pm

    It looks like you want something similar to

    handlebars templates/*.handlebars -f precompiled_templates.js
    

    except you would end up with ‘templates’ prefixed to each file. My preferred approach requires two lines:

    files=( templates/*.handlebars )
    handlebars "${files[@]#templates/}" -f precompiled_templates.js.
    

    The first line puts all the desired files in an array. In the second line, we expand the contents of the array, but stripping the “templates/” prefix from each element in the resulting expansion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been messing around with a backbone.js app using require.js and a handlebars templates
I'm using the Handlebars templating engine on the app I'm building to render the
I'm using backbone boilerplate to render my templates, its fetchTemplate method caches the rendered
I'm currently using Handlebars.js (associated with Backbone and jQuery) to make a web app
I want to be able to define templates once and use them to render
I'm creating a search results page using Backbone in combination with CoffeeScript and Handlebars.
Render attachment names from couchdb without conversion using handlebars or mustache template. { _id:123,
I'm using Handlebars templates and JSON data is already represented in [Object object], how
I am trying to add an ember view using handlebars.js in jade. When I
I am using the runtime build of handlebars and trying to use a registered

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.