将Jade集成到Yeoman的服务器/监视/重载任务中 [英] Integrating Jade in Yeoman's server/watch/reload tasks

查看:158
本文介绍了将Jade集成到Yeoman的服务器/监视/重载任务中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在玩 Yeoman & Jade 。我已经通过 yeoman init angular 创建了一个小测试应用程序(它是一个角度应用程序,但这不是重点)...

当我在命令行输入 yeoman server 时,它会:


  • 编译 coffeescript & 指南针文件

  • 启动服务器

  • 启动浏览器

  • 观看&重新加载coffeescript&浏览器中的罗盘变化



这是Yeoman的一大特色!



现在我需要与Jade相同的功能。因此,我安装了 grunt-通过 npm安装grunt-jade ,并在 GruntFile.js 中添加以下配置来编译玉石模板:

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

我能够将 jade 任务集成到 Yeoman的手表中&安培;通过在 watch 任务中添加以下配置来重新加载任务

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

所有作品都非常出色。 。除非在命令中加入 jade 任务,否则初始编译不会发生:

  yeoman玉器服务器

我们的管家不喜欢这个漂亮的女孩,因为他因为 yeoman server 将只编译coffeescript &安培;指南针文件。



有没有办法将 jade 任务添加到默认执行 yeoman server

解决方案

Jaoman with Yeoman:使用Yeoman和Jade


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?

解决方案

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

这篇关于将Jade集成到Yeoman的服务器/监视/重载任务中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆