Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to copy compiled jade files to a destination folder using grunt
    primarykey
    data
    text
    <p>For a single page app that I'm working on, I have the following structure:</p> <ul> <li>dist <ul> <li>css</li> <li>js</li> <li>lib</li> <li>partials</li> <li>index.html</li> </ul></li> <li>src <ul> <li>css</li> <li>js</li> <li>lib</li> <li>views <ul> <li>partials</li> <li>index.jade</li> </ul></li> </ul></li> </ul> <p>Directory <strong>dist</strong> will be used by the express server to serve the project. I have trivial grunt tasks (using <em>grunt-contrib-clean</em>, <em>grunt-contrib-copy</em>) for cleaning <strong>dist</strong> and copying <strong>src/css</strong>, <strong>src/js</strong>, <strong>src/lib</strong> to <strong>dist</strong>.</p> <p>The problem lies with <strong>src/views</strong>. This directory contains jade files which need to be compiled to html files. After compilation I want them in <strong>dist</strong> (index.html in the dist root, partials as subdir).</p> <p>At the moment I am using the <strong>grunt-contrib-jade</strong> 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):</p> <pre><code> 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'] } } }, </code></pre> <p><strong>Is there any way to use the grunt-contrib-jade task (or another one) with a directory filter?</strong> Like this:</p> <pre><code> jade: { compile: { options: { pretty: true }, dir: { 'dist': ['src/views'] } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload