如何让Grunt.js和Meteor.js一起工作? [英] How to make Grunt.js and Meteor.js work together?

查看:109
本文介绍了如何让Grunt.js和Meteor.js一起工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Meteor应用程序中使用简单的复制和连接。但是当Meteor在服务器和客户端都运行所有javascript文件时,我遇到了这个问题,而我不希望它们在任何地方运行。它只是像 Gruntfile.js 这样的配置文件或者我想要以某种方式进行处理的部分JS文件,然后放入客户端文件夹中。



现在,在应用程序的根目录中有 Gruntfile.js 文件,当我尝试启动meteor应用程序时,出现此错误:

  W20130826-14:44:39.921(3)? (STDERR)/home/../../.meteor/local/build/programs/server/boot.js:184 
W20130826-14:44:40.062(3)? (STDERR)})。run();
W20130826-14:44:40.062(3)? (STDERR)^
W20130826-14:44:40.062(3)? (STDERR)ReferenceError:模块没有定义

我知道我可以说Meteor忽略文件或通过在文件名的开头添加句点,并且它使用 .Gruntfile.js 文件名,但当然Grunt在这种情况下不起作用。那么我怎么才能让他们一起工作呢?我怎么能说流星忽略任何文件或文件夹,而不重命名它? ,并将node_modules和grunt文件保存在顶层:

  ./ Gruntfile 
./package.json
./node_modules
./app/.meteor
./app/<其他流星文件>


I want to use simple copying and concatenation in my Meteor application. But I faced the problem when Meteor runs all javascript files both on server and client whereas I don't want them to be run anywhere. It's either just config file like Gruntfile.js or partial JS files which I want to process somehow and then put inside client folder.

Now, with Gruntfile.js file in the root of application I have this error when trying to launch meteor application:

W20130826-14:44:39.921(3)? (STDERR) /home/../../.meteor/local/build/programs/server/boot.js:184
W20130826-14:44:40.062(3)? (STDERR) }).run();
W20130826-14:44:40.062(3)? (STDERR)    ^
W20130826-14:44:40.062(3)? (STDERR) ReferenceError: module is not defined

I know that I can say to Meteor to ignore file or folder by adding period at the beginning of the filename, and it's working with .Gruntfile.js filename, but of course Grunt does not work in such case. So how can I make them work together? How can I say to Meteor to ignore any file or folder without renaming it?

解决方案

You can put your meteor app in a subdirectory, and keep node_modules and your grunt file in the top level:

./Gruntfile
./package.json
./node_modules
./app/.meteor
./app/<other meteor files>

这篇关于如何让Grunt.js和Meteor.js一起工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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