Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript: get package.json data in gulpfile.js

Not a gulp-specific question per-se, but how would one get info from the package.json file within the gulpfile.js; For instance, I want to get the homepage or the name and use it in a task.

like image 845
Lane Avatar asked Mar 25 '14 20:03

Lane


1 Answers

This is not gulp specific.

var p = require('./package.json') p.homepage 

UPDATE:

Be aware that "require" will cache the read results - meaning you cannot require, write to the file, then require again and expect the results to be updated.

like image 162
Mangled Deutz Avatar answered Oct 04 '22 18:10

Mangled Deutz