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

parched-tasks-webapp

v0.2.15

Published

Adds a webapp workflow to parched

Downloads

7

Readme

parched-tasks-webapp

Uses features from Parched and browserify for pain free development times. Bower is also supported, though not given the exact same treatement as app/ or vendor/.

You do have to structure your app a certain way:

app/
├── assets/
├── scripts/
├── styles/
└── views/
vendor/
├── assets/
├── scripts/
├── styles/
└── views/

However, given this:

npm install --save gulp parched parched-tasks-webapp
# Okay now we will install some plugins
npm install --save parched-coffee \
    parched-jade \
    parched-minify-css \
    parched-sass \
    parched-svg2png \
    parched-uglify \
    parched-webfont

... and a Gulpfile.js containing:

Parched.setup({
  gulp: gulp,

  parchedWillBuild: function(done) {
    console.log('Before');
    done();
  },

  parchedDidBuild: function(done) {
    console.log('After');
    done();
  }
});

... you have a process that will:

  • Support bower dependencies.
  • Support coffeescript (in vendor/scripts/ and browserify).
  • Support jade (in app/views/, vendor/views/ and browserify).
  • Support sass (in app/styles/ and vendor/styles/).
  • Support ordering of any concat'd files via before and after properties.
  • Build a webfont based on .svg files in app/assets/glyphs/.
  • Build both a retina and non-retina spritemap based on .svg files in app/assets/sprites/.
  • Minify javascript in production.
  • Minify css in production.
  • Error hard in production.
  • Use browserSync in development.
  • Stay out of your way.
  • Allow you to intervene at pretty much any point.

Usage

To cleanup public/ and tmp/:

gulp parched-clean

To watch files in development

gulp parched-watch

To build everything:

gulp parched-build

To build and minify everything:

NODE_ENV=production gulp parched-build

Bundles

parched-tasks-webapp has a concept of "bundles". Directories of files are considered to be a "bundle", provided there is some configuration.

The default bundle is app, and its configuration looks like:

Parched.setup({
  webapp: {
    bundles: {
      app: {
        src: './app/',
        dest: './public/',
        shouldCopyVendor: true,
        shouldConcatVendor: false
      }
    }
  }
})

What this means is scripts in ./app/ will be built as ./public/app.js, styles will be concated to ./public/app.css, and any assets / views will go to ./public/.

The src property will default to the bundle name and if no bundles specify shouldCopyVendor then it is set for you on the first bundle. Set shouldConcatVendor if you would like the vendor scripts and styles to be concated to the beginning of the bundle files.

Note for Parched plugin authors

Because this behavior is specific to parched-tasks-webapp and messes up any generic paths your workflow may assume, check for streamContext.bundleName in your plugins method.

export default function (Parched) {
  Parched.createPlugin({
    displayName: 'my-awesome-plugin',
    
    transform (streamContext) {
      let src = '**/*.svg'
      let dest = 'public/'
      
      if (streamContext.bundleName) {
        // we are being called by `parched-tasks-webapp`
        src = `${streamContext.bundleSrc}/**/*.js`
        dest = streamContext.bundleDest
      }
    }
  })
}