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

foolish

v1.4.0

Published

Another foolish frontend build script.

Downloads

40

Readme

A foolish front-end building script

Building is not fun, especially so many choices (gulp, webpack, systemjs, ...) to make a building system for you (or your team).

So I decide to jump out of this shit pit. Here is my solution.

Concept

  • Simpler is better.
  • Convention over configuration. (Actully, there is nothing you can change)

Should I use this?

This build script is for single page app. It just concat all project scripts to one, and compile a less style. No framework specified.

Installation

npm install -g foolish

How to use

  • Building project: foolish
  • Start a dev server: foolish server

Document

Filename conventions

Any directory is a valid foolish project, even if it's empty. Some filename is special but not required:

  1. index.html: this is the landing page.
  2. main.js: this script will be at the top in combiled script.
  3. run.js: this script will be at the ned in combiled script.
  4. main.less: write your less style here.
  5. app.js: only use this in index.html, your project should not have this file, it's combined output script filename.
  6. app.css: only use this in index.html, your project should not have this file, it's compile style filename.

Here is a basic web page project which contains script and stylesheet:

  1. mkdir my-foolish-project && cd my-follish-project.
  2. echo '<link href="app.css" rel="stylesheet"></link>' > index.html.
  3. echo '<script src="app.js" type="text/javascript"></script>' >> index.html.
  4. touch main.js.
  5. touch main.less.

Development Server

Use command foolish server, a small http server will start listening on port 3000.

Look at the initialize step, I think you already realized there is no app.js or app.css. Those files are virtual, which generated by development server or building script.

app.js will load all your scripts, app.css is generated from main.less.

You can use --port parameter to change the server port.

Building

Just run foolish under your project directory, then you will get a dist directory which contains what you want.

The building prosess is simple:

  1. Concat all .js files in your project directory (except node_modules) to dist/app.js. main.js will at head and run.js will be the last.
  2. Compile main.less to dist/app.css.
  3. Find assets which refrenced by index.html and dist/app.css, copy them to dist directory.

Other scripts

FAQ

Q: How can I import 3rd-party modules?

A: Just create a <script> tag in index.html to reference a script file. The file location can be in internect (like CDN server) or just a local dependency in node_modules (npm install is welcome).

Q: Can I add some pre-process plugin like coffee or babel?

A: Sure but not in foolish. You can do this by shell command.

Contribution

PR is welcome. I'll very happy if someone tell me some feature is useless and can be drop out.

License

MIT