gh-pages
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
async | 3.2.5 | 146.47 kB | MIT | prod | |
commander | 11.1.0 | 44.69 kB | MIT | prod | |
email-addresses | 5.0.0 | 23.69 kB | MIT | prod | |
filenamify | 4.3.0 | 2.98 kB | MIT | prod | |
find-cache-dir | 3.3.2 | 3.06 kB | MIT | prod | |
fs-extra | 11.2.0 | 14.91 kB | MIT | prod | |
globby | 6.1.0 | 3.02 kB | MIT | prod |
The gh-pages
npm package enables you to publish files to a gh-pages
branch on GitHub, though it can also be employed for any other branch on any other remote. This is especially useful for front-end developers as it simplifies the process of updating the demo site for a project.
The gh-pages
package is easy to use. You start by installing it as a development dependency using the command npm install gh-pages --save-dev
. Once installed, import it in your script file using var ghpages = require('gh-pages')
. To publish files, call the publish method and provide the directory that contains the files you want to publish. Here is an example:
var ghpages = require('gh-pages');
ghpages.publish('dist', function(err) {});
In this example, 'dist' is the folder that contains the files you want to publish on the gh-pages
branch. The function ghpages.publish
takes two arguments - the path to the directory and a callback function that will be executed once publishing is done.
The gh-pages
package provides a number of configuration options via an options
object in the publish
method. You can customize the branch name, commit message, repository URL, add dotfiles, and more.
The entire documentation and more code usage examples for gh-pages
can be found in the README file on its GitHub repository here.
The gh-pages
package can also be used from the command-line. Install the package globally by using the command npm install -g gh-pages
. After installation, you can use the gh-pages
command directly in your command line. Here is an example of how to do so:
"scripts": {
"deploy": "gh-pages -d dist"
}
To publish everything from your dist
folder to your gh-pages
branch, run npm run deploy
.
The above commands will allow you to efficiently boost your JS project's visibility by harnessing GitHub's built-in gh-pages hosting.