Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
572 views
in Technique[技术] by (71.8m points)

node.js - Integrating Jade in Yeoman's server/watch/reload tasks

I've been playing around with Yeoman & Jade. I've created a small test app via yeoman init angular (it's an angular app, but that's not the point here)...

When I enter yeoman server at the command line, it will:

  • compile coffeescript & compass files
  • start a server
  • start a browser
  • watch & reload coffeescript & compass changes in the browser

Which is a great feature of Yeoman!

Now I want the same feature with Jade. So I installed grunt-jade via npm install grunt-jade and added the following config in GruntFile.js to compile the jade templates:

   jade: {
      html: {
        src: ['app/views/*.jade'],
        dest: 'app/views',
        options: {
          client: false
        }
      }
    },

I was able to integrate the jade task in Yeoman's watch & reload tasks by adding the following config in the watch task:

  watch: {
     ...
     jade: {
       files: 'app/views/*.jade',
       tasks: 'jade reload'
     },
     ...
  }

And all works wonderfully well... except that the initial compile does not occur unless I add the jade task to the command:

yeoman jade server

Our butler doesn't like this nice girl, because he won't let her integrate with his server task :) And that is annoying, since yeoman server will compile only coffeescript & compass files.

Is there any way how I could add the jade task to the default execution of yeoman server?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

We created a guide on how to integrate Jade with Yeoman: Using Yeoman and Jade


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...