Set of build tools designed to be used with Tollan applications/modules.
These tools are highly opinionated and thus will not be good for all projects. Some configuration is possible with the addition of a
Tasks are in the form of promises, which may be combined to form your build sequence just like promises in your source code. Gulp is only used for its file streaming and watching capabilities; tasks are not actual Gulp tasks.
Install this, plus Gulp and bunyan:
npm install --save gulp tollan-gulp bunyan
Gulpfile.js next to your
package.json with something like the following:
'use strict';var gulp = ;var tasks = ;gulp;gulp;gulp;
tollanfile.js with, at minimum, the following:
'use strict';moduleexports =// Put your configuration here;
Add the following to the "scripts" section of your
NODE_ENV can be set to one of the following three values:
development: Generally used with
gulp watch, enables all debug logging, source maps, no minification.
production: Debug features disabled, minification enabled
staging: Designed for use with continuous integration or a staging server. Similar to
The following tasks are provided:
tasks.jshint: Lints your code using eslint
tasks.browserify: Browserifies your module. Includes babelify and source maps. Does not include any modules listed in
browserifyDependencies. Resulting file is named
main.src.jsin prod/staging and
main.jsin dev. If building a module it will build the demo scripts instead.
main.js. If building a module it will uglify the demo browserify bundle instead. Unsafe and non-IE8-compatible compression is enabled, thus it may break some bundles.
tasks.disc: Runs your browserify bundle
main.jsthrough disc to create a dependency visualization. Resulting file is named
disc.html. If building a module it will discify the demo browserify bundle instead.
tasks.vendor: Browserifies your
browserifyExternalmodules into a
vendor.js, and browserifies each
browserifyDependenciesinto a file named to match the module name. Also uglifies in staging and production. Should not be used with modules.
LESS style tasks:
tasks.recess: Lints your styles using recess
tasks.less: Builds your main and critical styles from LESS to CSS
tasks.cssnext: Runs cssnext on your built main and critical CSS, overwriting them
tasks.assets: Copies your asset files to the destination directory.
tasks.spawn: Runs a task in a separate Node process. Give the task filename as an argument without the extension.
Composite tasks: These combine several af the above tasks into common workflows
tasks.composite.styles: Runs less then cssnext
Watch tasks: Similar to composite tasks but watch your source files for changes
tasks.watch.scripts: Runs babel, browserify, and/or disc tasks when your scripts change
tasks.watch.styles: Runs less then cssnext when your styles change
tasks.watch.assets: Runs the assets task when your asset files change
The default configuration will work for some standalone applications. You can override any configuration by creating a
tollanfile.js next to your package.json.
For a list of all settings with a description of what they do and the default values, see the source of
- Either remove the dependency on Gulp, or implement tasks as proper Gulp tasks. Gulp 3 does not have a good sequence runner, which is why I used promises; I'm told Gulp 4.0 adds this functionality.
- Improve error handling, it's a bit buggy. I'm told Gulp 4.0 is significantly better in this aspect.
- Test with Gulp 4.0 so I can do the above two
- Improve commenting and documentation
- Add configuration settings for more things.
Copyright 2014-2015 Paul Rayes Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.