custom-title
custom-title copied to clipboard
title from package.json?
can we set the 'name' in package.json as the window title?
This should work (put it as the "template" in the package settings):
<% var packageName; try { packageName = JSON.parse(require('fs').readFileSync(projectPath + '/package.json', {encoding: 'utf8'})).name; } catch (e) { packageName = ''; } if (packageName) { %><%= packageName %><% } else { %><%= projectName %><% } %>
It will attempt to read and parse the package.json at the root of the project (i.e. opened folder) and take the name from there, falling back to the regular projectName variable if a package.json name is not found.