How to use the grunt.file function in grunt

To help you get started, we’ve selected a few grunt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spmjs / spm / lib / sdk / grunt.js View on Github external
Object.keys(pkg.dependencies).forEach(function(depName) {
      // global task name should begin with grunt
      if (!/^grunt/.test(depName)) return;
      var filepath = path.join(rootdir, 'node_modules', depName);
      if (grunt.file.exists(filepath)) {
        // Load this task plugin recursively
        grunt.loadGlobalTasks(path.relative(NODE_PATH, filepath));
      }
    });
    // Load the tasks of itself
github TypeStrong / grunt-ts / tasks-internal / modules / transformers.js View on Github external
// The code gen directive line automatically qualifies
                    outputLines.push(line);
                    // pass transform settings to transform (match[1] is the equals sign, ensure it exists but otherwise ignore it)
                    outputLines.push.apply(outputLines, transformer.transform(fileToProcess, match[1] && match[2] && match[2].trim()));
                    return true;
                }
                return false;
            })) {
                continue;
            }
            // Lines not generated or not directives
            outputLines.push(line);
        }
        var transformedContent = outputLines.join(utils.eol);
        if (transformedContent !== contents) {
            grunt.file.write(fileToProcess, transformedContent);
        }
    });
}
github chrishumboldt / Webplate / webplate / core / grunt / node_modules / grunt-contrib-watch / node_modules / gaze / benchmarks / gaze100s.js View on Github external
'setUp': function(done) {
    // ensure that your `ulimit -n` is higher than amount of files
    if (grunt.file.exists(watchDir)) {
      grunt.file.delete(watchDir, {force:true});
    }
    createFiles(100, path.join(watchDir, 'one'));
    createFiles(100, path.join(watchDir, 'two'));
    createFiles(100, path.join(watchDir, 'three'));
    createFiles(100, path.join(watchDir, 'three', 'four'));
    createFiles(100, path.join(watchDir, 'three', 'four', 'five', 'six'));
    process.chdir(watchDir);
    done();
  },
  'tearDown': function(done) {
github mathiasbynens / grunt-template / tests / tests.js View on Github external
var compare = function(inputFile, expectedOutputFile, description, test) {
	var actual = grunt.file.read(inputFile);
	var expected = grunt.file.read(expectedOutputFile);
	test.equal(actual, expected, description);
	test.done();
};
github tinganho / grunt-dot-compiler / test / test_dot_compile.js View on Github external
exec('grunt dot:node', function(error, stdout, stderr) {
      nodeTmpl = grunt.file.read('test/output/tmpl.js');
      done();
    });
  });
github tinganho / grunt-dot-compiler / test / test_dot_compile.js View on Github external
exec('grunt dot:requirejs', function(error, stdout, stderr) {
      requirejsTmpl = grunt.file.read('test/output/tmpl.js');
      done();
    });
  });
github brandung / capitan / grunt / helpers.js View on Github external
Helpers.checkString = function (regStr, file) {
	var configFile = grunt.file.read(file),
		patt = new RegExp(regStr);

	return patt.test(configFile);
};
github yapplabs / glazier / configurations / shell.js View on Github external
function cardPackage(dirname) {
  return grunt.file.readJSON('cards/' + dirname + '/package.json' );
}
github naver / egjs / config / exec.js View on Github external
markdown += grunt.template.process(template.module, { data: {
						module: z
					}});

					for (var i = 0, el; el = logdata[x][z][i]; i++) {
						markdown += grunt.template.process(template.item, { data: {
							subject: el.subject,
							issueNo: el.issueNo,
							url: grunt.config("exec.changelog.issueURL"),
							hash: el.hash
						}});
					}
				}
			}

			grunt.file.write("CHANGELOG.md", markdown, { encoding: "UTF-8" });
		},
		stdout: false