Add support for basedir option #64

Closed
sgtpep opened this Issue Dec 5, 2013 · 6 comments

Projects

None yet

5 participants

@sgtpep
sgtpep commented Dec 5, 2013

I found mention about this option here: http://stackoverflow.com/questions/11675453/jade-loading-templates-from-different-directories#comment27283495_11677885

It allows to use absolute paths in exclude and include directives (starting with slash).

@x1024
x1024 commented Dec 25, 2013

+1

@tkellen
Member
tkellen commented Dec 26, 2013

PRs welcome!

@mathiasschopmans
Contributor

Just add basedir to your options.

jade: {
  compile: {
    options: {
      basedir: "path/to/jade/root/",
      data: {
        debug: false
      }
    },
    files: [{
      expand: true,
      flatten: true,
      cwd: 'path/to/jade/template-root/',
      src: ['*.jade'],
      dest: 'path/to/html/output',
      ext :'.html'
    }]
  }
}
@tkellen tkellen closed this Feb 19, 2014
@vlatri
vlatri commented Aug 20, 2015

@mathiasschopmans, could you tell me where should I look for these options, please?

@mathiasschopmans
Contributor

Hi @vlatri5264,
sorry I don't see your problem. 😕

If my previous answer doesn't solve your question, can you please add a link to a repository you're working on?

Maybe the following Gruntfile.js might help you more. Please adjust the paths.

module.exports = function(grunt) {

  grunt.initConfig({
    jade: {
      yourTaskName: {
        options: {
          basedir: 'path/to/jade/template-root/',
        },
        files: [{
          expand: true,
          flatten: true,
          cwd: 'path/to/jade/template-root/',
          src: ['*.jade'],
          dest: 'path/to/html/output',
          ext :'.html'
        }]
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-jade');
  grunt.registerTask('default', ['jade']);

};
@vlatri
vlatri commented Aug 21, 2015

Thanks, @markdalgleish, your solution works))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment