3

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?

3 Answers 3

7

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>
1
  • 1
    Agreed, this makes more sense especially if you want to do string replace on config files. Your template can exist in the root with your Gruntfile and you can move that to the meteor directory and make changes.
    – occasl
    Jun 7, 2014 at 0:05
5

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

2

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

grunt --gruntfile .Gruntfile.js
3
  • Can I do the same with node_modules folder? Aug 27, 2013 at 18:54
  • No you unfortunately cannot. Aug 27, 2013 at 19:50
  • Meteor considers every js/coffee file in its directory as part of the meteor app, so the issue isn't the name, but the relative location. Sep 12, 2014 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.