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

  • SEARCH
  • Home
  • 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 9061737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:33:42+00:00 2026-06-16T15:33:42+00:00

For a single page app that I’m working on, I have the following structure:

  • 0

For a single page app that I’m working on, I have the following structure:

  • dist
    • css
    • js
    • lib
    • partials
    • index.html
  • src
    • css
    • js
    • lib
    • views
      • partials
      • index.jade

Directory dist will be used by the express server to serve the project. I have trivial grunt tasks (using grunt-contrib-clean, grunt-contrib-copy) for cleaning dist and copying src/css, src/js, src/lib to dist.

The problem lies with src/views. This directory contains jade files which need to be compiled to html files. After compilation I want them in dist (index.html in the dist root, partials as subdir).

At the moment I am using the grunt-contrib-jade task to compile and copy the jade files. I want to copy them to dist, since I don’t want to add the compiled html files to source control. But now this is not really workable, since you have to specify every jade file (now there are only a few, but that will grow):

   jade: {
        compile: {
            options: {
                pretty: true
            },
            files: {
                // TODO make one line
                'dist/index.html': ['src/views/index.jade'],
                'dist/partials/banner.html': ['src/views/partials/banner.jade'],
                'dist/partials/dashboard.html': ['src/views/partials/dashboard.jade'],
                'dist/partials/navbar.html': ['src/views/partials/navbar.jade'],
                'dist/partials/transfer.html': ['src/views/partials/transfer.jade']
            }
        }
    },

Is there any way to use the grunt-contrib-jade task (or another one) with a directory filter? Like this:

   jade: {
        compile: {
            options: {
                pretty: true
            },
            dir: {
                'dist': ['src/views']
            }
        }
    }
  • 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-16T15:33:43+00:00Added an answer on June 16, 2026 at 3:33 pm

    I ended up upgrading to grunt 0.4 (which causes some other problems, but that I’ll be able to handle).

    With grunt version 0.4 it is possible to use grunt.file.expandMapping:

        jade: {
            compile: {
                options: {
                    pretty: true
                },
                files: grunt.file.expandMapping(['**/*.jade'], 'dist/', {
                    cwd: 'src/views',
                    rename: function(destBase, destPath) {
                        return destBase + destPath.replace(/\.jade$/, '.html');
                    }
                })
    
            }
        },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have A single page that has the following structure <form runat=server><placeholder></placeholder></form> I have
I am working in a single page app that has the following layout: I
If I have a single page with many forms of existing records: index.html.haml -
Background: I'm working on a single page web app that loads everything through AJAX
I have an ASP.NET web app that uses a single page, but makes some
I have an ASP.NET 3.5sp1 app that is a single page design. The site
I have a single page web app that shows real time data using just
I have a single-page app that uses a lot of CSS3 shadows. The app
I have a single page app that integrates with other services such as Dropbox
We have an single-page web app that displays emails. Some of the emails we're

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.