@appius-digital/task-build-scripts

Use this tool to process Javascript into production-ready code as part of your build process.

Usage no npm install needed!

<script type="module">
  import appiusDigitalTaskBuildScripts from 'https://cdn.skypack.dev/@appius-digital/task-build-scripts';
</script>

README

Appius Build Tool: Build Scripts

Use this tool to process Javascript into production-ready code as part of your build process.

Installation

Run the following command from your project root.

npm install @appius-digital/task-build-scripts --save

Usage

Add the following to your gulpfile.js

require('@appius-digital/task-build-scripts')(gulp, {
  task: 'build-scripts',
  src: ['src/js/main.js'],
  dest: 'dist/js' });

Options

Name Type Required Default Description
task String No 'build-scripts' The name of the task to be initialised
src Array Yes The globs to be processed
dest String Yes Directory to place the processed files
plugins.terser.enabled Boolean No true Enable or disable terser (minifier)
plugins.terser.config Object No {} A set of terser options
plugins.sourcemaps.enabled Boolean No true Enable or disable sourcemaps
plugins.browserify.enabled Boolean No true Enable or disable browserify (bundler)
plugins.browserify.output String No 'main.js' The output bundle file name
plugins.babel.enabled Boolean No true Enable or disable babel (ES6 compiler)
plugins.babel.config Object No {} A set of babel options
plugins.include.enabled Boolean No false Enable or disable include
plugins.include.config Boolean No {} A set of gulp-include options

Configuration

This is a zero-config task. Some optional configuration can be set on the terser plugin, but is not required. Bable is pre-configured to use the standard @babel/preset-env preset.

Note on include and sourcemaps

The include plugin will break the output sourcemap if the source files use Windows line endings (CRLF). If you need to use includes, please ensure all source files use Unix line endings (LF) instead.

Copyright and license

Code and documentation Copyright 2019 Appius. Code released under the MIT License.