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

apc-build

v0.4.5

Published

Gulp build scripts for front end APC projects

Downloads

2

Readme

APC Build Tools

Build Status Coverage Status Greenkeeper badge Maintainability

Gulp build scripts for front end APC projects

Task register helpers

register(gulp, config) ⇒ Object

Register gulp tasks based on a passed config object

Returns: Object - registerWatchers function and array of registered task names

| Param | Type | Default | Description | | --- | --- | --- | --- | | gulp | Object | | Gulp instance | | config | Object | | Config Object | | config.scssSrc | String | | Path of Sass files to lint and/or build | | config.jsSrc | Array | String | | Path[s] of Js files to lint | | config.jsEntry | Array | String | | Path[s] of Js files to build | | config.pugSrc | Array | String | | Path[s] of pug files to lint | | [config.scssIncludePaths] | Array | [] | SCSS include paths (for frameworks etc) | | config.jsDest | String | | Destination for Js built files | | config.jsDestFilename | String | | Filename for built Js file | | config.cssDest | String | | Destination for built CSS | | config.jsSrc | Array | String | | Path[s] of Js files to lint | | config.imgSrc | Array | String | | Path[s] for image files to be built | | config.imgDest | String | | Destination for built image files | | [config.showFileSizes] | Boolean | true | Show file sizes in console output? | | config.browserifyIgnore | Array | | Browserify paths to ignore |

Example

const gulp = require('gulp')

const register = require('apc-build').register(gulp, {
  scssSrc: 'src/**\/*.scss',
  scssIncludePaths: [],
  cssDest: 'output/css',
  showFileSizes: true
})

console.log(register)
// Returns
// {
//   tasks: [ 'lint-sass', 'build-sass' ],
//   registerWatchers: [Function: registerWatchers]
// }

register.registerWatchers(gulp)

Register watchers corresponding to the tasks already set up

Kind: method of [register] return(#register)

| Param | Type | Description | | --- | --- | --- | | gulp | Object | Gulp instance |

Example

const gulp = require('gulp')

const register = require('apc-build').register(gulp, config)

// Watchers corresponding to config values
// will be registered within watch task
gulp.task('watch', () => {
  register.registerWatchers(gulp)
})

Gulp tasks

build-img(gulp, path, dest) ⇒ function

Copy and compress images with imagemin

Returns: function - Gulp task

| Param | Type | Description | | --- | --- | --- | | gulp | Object | Gulp instance | | path | Array | String | Path[s] for image files to be built | | dest | String | Output Destination |

Example

const gulp = require('gulp')
const tasks = require('apc-build')

gulp.task('build-img', tasks['build-img'](gulp, ['src/img/*'], 'dist/img'))

build-js(gulp, entries, dest, [destFilename], [showFileSizes], [browserifyIgnore]) ⇒ function

Bundle and browserify front end JS files

Returns: function - Gulp task

| Param | Type | Default | Description | | --- | --- | --- | --- | | gulp | Object | | Gulp instance | | entries | String | Array | | Path[s] of Js files to build | | dest | String | | Destination for Js built files | | [destFilename] | String | 'bundle.js' | Filename for built Js file | | [showFileSizes] | Boolean | true | Show file sizes in console output? | | [browserifyIgnore] | Array | [] | Browserify paths to ignore |

Example

const gulp = require('gulp')
const tasks = require('apc-build')

gulp.task('build-js', tasks['build-js'](gulp, ['src/js/entry.js'], 'dist/js', 'bundle.js'))

build-sass(gulp, path, dest, scssIncludePaths, showFileSizes) ⇒ function

Compile sass files

Returns: function - Gulp task

| Param | Type | Description | | --- | --- | --- | | gulp | Object | Gulp instance | | path | Array | String | Path of Sass files to build | | dest | String | Destination for built CSS | | scssIncludePaths | Array | Sass include paths (for frameworks etc) | | showFileSizes | Boolean | Show file sizes in console output? |

Example

const gulp = require('gulp')
const tasks = require('apc-build')

gulp.task('build-sass', tasks['build-sass'](gulp, ['src/scss/*.scss'], 'dist/css', ['node_modules/foundation-sites/scss']))

lint-js(gulp, path) ⇒ function

Lint js files using eslint

Returns: function - Gulp task

| Param | Type | Description | | --- | --- | --- | | gulp | Object | Gulp instance | | path | Array | String | Path[s] of Js files to lint |

Example

const gulp = require('gulp')
const tasks = require('apc-build')

gulp.task('lint-js', tasks['lint-js'](gulp, ['src/js/*']))

lint-pug(gulp, path) ⇒ function

Lint pug files using pug linter

Returns: function - Gulp task

| Param | Type | Description | | --- | --- | --- | | gulp | Object | Gulp instance | | path | Array | String | Path[s] of pug files to lint |

Example

const gulp = require('gulp')
const tasks = require('apc-build')

gulp.task('lint-pug', tasks['lint-pug'](gulp, ['app/views/*.pug']))

lint-sass(gulp, path) ⇒ function

Lint sass files using sass-lint

Returns: function - Gulp task

| Param | Type | Description | | --- | --- | --- | | gulp | Object | Gulp instance | | path | String | Path of Sass files to lint and/or build |

Example

const gulp = require('gulp')
const tasks = require('apc-build')

gulp.task('lint-sass', tasks['lint-sass'](gulp, 'src/scss/*'))

Utilities

is-gulp(gulp)

Test if object is an instance of gulp

Throws:

  • Error Gulp instance not passed

| Param | Type | Description | | --- | --- | --- | | gulp | Object | Gulp instance |