How to make Grunt.js and Meteor.js work together?

让人想犯罪 __ 提交于 2019-12-22 10:17:14

问题


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?


回答1:


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>



回答2:


You can place a folder named 'private' in the root of your project and it will not be considered when Meteor is building (Meteor version 0.8.1).

├── client
├── common
├── packages
├── private
│   ├── Gruntfile.js
│   ├── config.rb
│   ├── node_modules
│   └── package.json
├── public
├── server
├── smart.json
└── smart.lock

Then do

cd private
grunt watch

Best regards

/Wille




回答3:


I have no idea how Meteor works but you can change the gruntfile name with:

grunt --gruntfile .Gruntfile.js


来源:https://stackoverflow.com/questions/18443412/how-to-make-grunt-js-and-meteor-js-work-together

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!