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

@wiscweb/gulp

v3.1.2

Published

Gulp build tasks for developing child themes and plugins for UW Madison's WiscWeb service.

Downloads

46

Readme

WiscWeb Gulp Tasks

Gulp build tasks for developing child themes and plugins for UW Madison's WiscWeb service.

Usage notes:

Implement this package in your gulpfile like so:

const gulp = require("gulp");
require("@wiscweb/gulp")(gulp);

You must pass in the gulp package info the WiscWeb gulp function to allow the module to properly define the build tasks.

Default Usage

You do not need to set any configuration parameters for this module to build assets. By default this module makes the following assumptions:

Styles

Source glob: ./src/styles/**/*.scss

Scripts

Source glob: ./src/scripts/**/*.js

Dist Directory

Destination: ./dist

Bundle

Source glob: ['./**/*', "!node_modules", "!node_modules/**/*", "!.git", "!.git/**/*", !${config.src}, !${config.src}/**/*] This will include everything in the project except node_modules, .git, and the configured src directory.

File Hashing

This module provides the option to hash files after they are built and save the hashes to a .php file. This can be useful for dynamically "versioning" style and script assets by using the file's hash rather than using a version number.

Example Hash Output:

<?php
define("MAIN_CSS_HASH", "03a43eebac7eb50c305a879a4d29ebcd");

Bundling

To deploy to WiscWeb there must be a zip called bundle.zip that contains everything to be deployed. The bundle task provided by this module takes a glob or an array of globs and automatically zips matching files into bundle.zip and places it at the root of the project. Custom globs can be set by setting the wiscweb.bundle property in package.json (more details below).

Custom Configuration

Optional configuration can be set in the package.json file by creating a property called wiscweb and adding the various properties detailed bleow.

Example:

// package.json
{
    "devDependencies": {
        "@wiscweb/gulp": "^3.0.0"
    },
    "wiscweb": {
        ...
    },
  ...
}

Configuration Properties:

src Optional <string> : The Path to the base src directory of your project.

dist Optional <string> : The Path to the base dist directory of your project.

styles Optional <string> : The path to your top level styles directory from the src/dist path. This should contain a leading slash. Example: /styles. This value will be combined with your src/dist value to create a full filepath.

scripts Optional <string> : The path to your top level scripts directory from the src/dist path. This should contain a leading slash. Example: /scripts. This value will be combined with your src/dist value to create a full filepath.

hashes Optional

  • hashes.dist <string> : The output file that file hash variables will be compiled to. This path must end with .php

  • hashes.src <array> : An array of key value objects.

    • hashes.src[].path <string> : The file path of a file to be hashed.

    • hashes.src[].key <string> : The global variable name this file's hash will be saved as.

bundle Optional <string> | <string[]> : A glob, or array of globs to be included in bundle.zip.

Example:

// pacakge.json
{
    "devDependencies": {
        "@wiscweb/gulp": "^3.0.0"
    },
    "wiscweb": {
        "src": "core",
        "styles": "/css",
        "hashes": {
            "dist": "./hashses.php",
            "src": [{ "path": "./dist/main.css", "key": "MAIN_CSS_HASH" }]
        },
        "bundle": ["./**/*.php", "./my-custom-file.js", "./dist/**/*"]
    }
}

The example above will do the following:

  • Compile all SCSS file located within ./core/css and output them to the default ./dist directory.
  • Generate a file hash for the main.css file located in ./dist and output it to hashses.php.
  • Create a zip file called bundle.zip containing all .php files, my-custom-file.js, and everything in the dist directory.