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

generator-posw

v0.2.0

Published

A Yeoman generator for a Plain Old Semantic Website

Downloads

42

Readme

generator-posw Build Status Built with Grunt

POSW stands for Plain Old Semantic Website. It's an opinionated Yeoman generator that will help you code a static website from design mockups. As Yeoman uses npm and Bower you need to have those two installed too, but you already know that, don't you? :)

Those who don't like the word Semantic when I speak about a website, not markup, can freely substitute that for something similar... Spectacular perhaps.

Features

POSW comes with a bunch of stuff:

  • It allows you to code either in PHP or HTML.
  • It uses Sass as a CSS preprocessor. You need to have Ruby and Sass installed and in your PATH for this to work.
  • The styles folder structure is made with BEM in mind.
  • Also it has a bunch of ready-to-use Grunt tasks that just work. More on that below.
  • It encourages you to use Bower as your dependencies manager

Getting Started

Depending on your setup, you may need to run the commands with sudo.

First you need to install Yeoman:

npm install -g yo

Then you need to install generator-posw from npm:

npm install -g generator-posw

Create a directory for your project and cd into it.

Finally, initiate the generator:

yo posw

Running this command will get you through a couple of questions to set you up. You'll need to specify what minimal version of Internet Explorer you need to support, what your language of preference is (PHP or HTML) and some other stuff.

The question about the minimal IE version is needed for two things: a) to print out the corresponding conditional comments on the html tag and b) to include two versions of jQuery (via again a conditional comment) if you choose to add it via Google's CDN and not Bower. If your minimal IE version is 10 or 11, you may freely choose the No IE option

If you choose PHP as your coding language, after this command you will hopefully get the following folder structure:

<project-folder>
|_<mockups>
|_<source>
|___<images>
|___<partials>
|___<scripts>
|______<libs>
|______project-slug.js
|___<styles>
|______<blocks>
|______<libs>
|______some default scss files
|___index.php
.bowerrc
bower.json
Gruntfile.js
package.json

and that's it, just a Plain Old Semantic Website.

Grunt tasks

There are three powerful Grunt tasks that are pre-configured for you:

grunt

The default task will wire your Bower dependencies, compile the default sass files, supply the needed vendor prefixes for some CSS properties and will watch for changes to the files. After this task successfully runs and waits watching your files, you can start coding :)

grunt build

The build task will create the build folder and copy the source files there making them production ready. Making HTML from PHP (if you choose PHP, otherwise grunt will copy the source files), concating Bower dependencies into one file and uglifying it, optimizing images using grunt-contrib-imagemin and so on. Do make sure to open at least one file to check if the paths to files are correct, which they should be :)

The build folder will look like this:

<project-folder>
|_<build>
|___<images>
|___<scripts>
|______vendor.js
|______project-slug.min.js
|___<styles>
|______libs.css
|______project-slug.css
|___index.html

The vendor.js file will contain all of the Bower dependencies plus the files you choose to include into it (like custom jQuery plugins you don't want to inject by Bower and what not).

grunt pack

The pack task will make a fresh build, then compress it into a zipball with a name <projectSlug>.<dd-mm-yyyy>.zip and put it into the archives folder.

PHP

As it's said in the features description you can choose to code in PHP. It will add the grunt-php2html task to convert PHP to HTML when running the build task. Make sure you carefully set up the php-cgi binary for your system.

In order to just open the coded PHP in the browser you need a PHP interpreter. It may come in a form of a WAMP, MAMP, XAMPP or any other ..AMP of your choice. If you speak Russian you may prefer to use Denwer. Besides that, if you happen to use PHPStorm, you can set this up even fancier.

If you have any troubles making PHP work for you, please fire an issue and I'll do my best to help, if I can.

License

MIT