Christian
Christian

Reputation: 7429

gruntjs environment variables. Are there any available?

Is there a list of variables, that I can use in my grunt config files? Something which I know from maven like project.build.dir..

Upvotes: 0

Views: 713

Answers (1)

Steve P
Steve P

Reputation: 19397

Several things may be of help to you.

1 - You can access any of the operating system's environment variables via process.environment, for example:

console.log( process.env.HOME );

2 - The typical approach to package-level information is to read it from package.json via the grunt.initConfig method. See the Project and Task Configuration Section of the Getting Started Guid.

3 - Since the convention is to have Gruntfile.js in the root of your project, all the other paths are relative to this, so when you have something like this in your task configuration, it's all relative to Gruntfile

    files: {
      src: './Libraries/Foo/foo.js'
    }

Upvotes: 3

Related Questions