Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apc-build

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apc-build

Gulp build scripts for front end APC projects

  • 0.4.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

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

ParamTypeDefaultDescription
gulpObjectGulp instance
configObjectConfig Object
config.scssSrcStringPath of Sass files to lint and/or build
config.jsSrcArray | StringPath[s] of Js files to lint
config.jsEntryArray | StringPath[s] of Js files to build
config.pugSrcArray | StringPath[s] of pug files to lint
[config.scssIncludePaths]Array[]SCSS include paths (for frameworks etc)
config.jsDestStringDestination for Js built files
config.jsDestFilenameStringFilename for built Js file
config.cssDestStringDestination for built CSS
config.jsSrcArray | StringPath[s] of Js files to lint
config.imgSrcArray | StringPath[s] for image files to be built
config.imgDestStringDestination for built image files
[config.showFileSizes]BooleantrueShow file sizes in console output?
config.browserifyIgnoreArrayBrowserify 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)

ParamTypeDescription
gulpObjectGulp 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

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

Bundle and browserify front end JS files

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

Compile sass files

lint-js(gulp, path)function

Lint js files using eslint

lint-pug(gulp, path)function

Lint pug files using pug linter

lint-sass(gulp, path)function

Lint sass files using sass-lint

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

Copy and compress images with imagemin

Returns: function - Gulp task

ParamTypeDescription
gulpObjectGulp instance
pathArray | StringPath[s] for image files to be built
destStringOutput 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

ParamTypeDefaultDescription
gulpObjectGulp instance
entriesString | ArrayPath[s] of Js files to build
destStringDestination for Js built files
[destFilename]String'bundle.js'Filename for built Js file
[showFileSizes]BooleantrueShow 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

ParamTypeDescription
gulpObjectGulp instance
pathArray | StringPath of Sass files to build
destStringDestination for built CSS
scssIncludePathsArraySass include paths (for frameworks etc)
showFileSizesBooleanShow 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

ParamTypeDescription
gulpObjectGulp instance
pathArray | StringPath[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

ParamTypeDescription
gulpObjectGulp instance
pathArray | StringPath[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

ParamTypeDescription
gulpObjectGulp instance
pathStringPath 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
ParamTypeDescription
gulpObjectGulp instance

Keywords

FAQs

Package last updated on 15 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc