Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for basedir option #64

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

Add support for basedir option #64

sgtpep opened this issue Dec 5, 2013 · 6 comments
Labels

Comments

@sgtpep
Copy link

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
Copy link

x1024 commented Dec 25, 2013

+1

@tkellen
Copy link
Member

tkellen commented Dec 26, 2013

PRs welcome!

@mathiasschopmans
Copy link
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 as completed Feb 19, 2014
@onedevlad
Copy link

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

@mathiasschopmans
Copy link
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']);

};

@onedevlad
Copy link

Thanks, @markdalgleish, your solution works))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants