npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-github-pages

v0.0.4

Published

Push to gh-pages no problem

Downloads

128

Readme

Grunt Github Pages

Publish your project's pages on Github with one command.

A Grunt task that enables you to publish to the gh-page branch with one command line.

Getting Started

npm install grunt-github-pages --save-dev

Preparing your repository

You need to create a folder and add it to your .gitignore file. In that folder you have to clone the same repository again and point to the gh-page branch.

Assume the target folder is named _site/ and our github repository is named project:

$ ls -la
.
..
.git
.gitignore
index.md

We add the _site folder in .gitignore and clone the current repository ( project ) to _site:

$ git clone [email protected]:thanpolas/project.git _site

$ cd _site

A full copy of the project repository now exists in the _site folder. We now need to point it to the gh-pages branch and we are good to go:

$ pwd
project/_site/

$ git checkout -b gh-pages
Switched to a new branch 'gh-pages'

$ git push origin gh-pages

Your repository is now ready to start using the Github Pages task!

The githubPages Task

Edit your Gruntfile and add the githubPages task:

  githubPages: {
    target: {
      options: {
        // The default commit message for the gh-pages branch
        commitMessage: 'push'
      },
      // The folder where your gh-pages repo is
      src: '_site'
    }
  }

  /* ... later on, after grunt.initConfig() call, create an alias: */

// create an alias for the githubPages task
grunt.registerTask('push', ['githubPages:target']);

So when you issue grunt push on your command line this is what will happen:

  1. The Current Working Directory will change to _site.
  2. The command git add . will be performed.
  3. The command git commit -am "push" will be performed.
  4. The command git push origin gh-pages will be performed.

The src Option

The src option must be a single string that represents a directory. The API is weak at this point but use cases need to be presented before a solution is attempted as there are a few intricacies involved. So do create an issue if you need globbing patterns here.

The dest Option

There are some cases, like building a Jekyll site, that the destination folder _site will get overwritten by the generation of static pages, along with the .git folder. For these kind of cases a trick would be to maintain one more ignored directory where the .git folder is retained.

The second ignored directory should be the dest option in your config file:

  githubPages: {
    target: {
      // The folder where your gh-pages repo is
      src: '_site',
      // The second ignored directory with the .git folder
      dest: '_site_git'
    }
  }

In this case, when you issue grunt push this is what will happen:

  1. All the contents of _site folder will be deep copied to _site_git overriding.
  2. The Current Working Directory will change to _site_git.
  3. The command git add . will be performed.
  4. The command git commit -am "auto commit" will be performed.
  5. The command git push origin gh-pages will be performed.

Other Options

commitMessage

Type: string Default: auto commit

The default commit message for the gh-pages branch.

remote

Type: string Default: origin

The name of the remote to be used when issuing git push.

pushBranch

Type: string Default: gh-pages

The name of the branch to be used when issuing git push.

Release History

  • v0.0.1, Mid Mar 2013
    • Big Bang

License

Copyright (c) 2013 Thanasis Polychronakis Licensed under the MIT.