1.11.56 • Published 5 years ago

dustman v1.11.56

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

d u s t m a n

Version TravisCI Built with nodejs 5.4.1 NPM MIT licence


Release 1.11.X details

TypeDescription
fixFirst empty action of the build folder not works always
fixRestores javascript sourcemaps
fixChanges node dependencies for compatibility reasons
fixUpdate node dependencies
featureBuild process is now integrated with desktop notifications

Gulp + YAML config based front-end automation boilerplate


Dustman is basically a set of Gulp tasks ready to be used as a build system which helps you to:

Build CSS

  • Build SASS or LESS autodetected with multiple themes.
  • Dynamic tasks with selective YAML configuration for every theme.
  • CSSlint tests.
  • StyleStats reports.
  • Autoprefixer for automated multiple browser support.
  • CSS vendors and assets already optimized for production environments.
  • Everything minimized in one file and with map support.

Build JavaScript

  • Apps with dependencies in sequence you need.
  • Everything minimized in one file and with map support.

Build HTML

  • Build Twig templates to HTML pages.
  • BrowserSync ready to be tested on multiple devices.
  • Faker ready to be used to add fake contents easily.
  • Moment ready to be used with faker to format dates easily.
  • HTML prettified to have consistently coded HTML templates.

Watch and Serve with HTTP server

  • Watch files automation tasks listeners to update your build automatically.
  • BrowserSync support to check CSS, JavaScript and HTML coded.

Gulp 4 alpha

At the moment Dustman is based on Gulp 4 which is in alpha release status so use it on your own risk! I didn't noticed any problems, but I didn't tested it in many environments.

Why Gulp 4?

  • Because it has a superior task concatenation system compared to the previous major release.
  • Because the watcher and the build system are faster.

Installation

The installation command will install dustman module in your package file and copy the dustman files to your project directory:

npm install --save dustman
cp -i ./node_modules/dustman/dustman.yml dustman.yml
cp -i ./node_modules/dustman/gulpfile.js gulpfile.js

The flag -i will prompt if you want to overwrite an existing file in the target directory.


Build suite

Dustman has a set of main tasks which uses a set of sub tasks in sequence.

Main tasks

The idea behind Dustman is to use a set of Gulp main tasks which shouldn't be changed, and decide how to build by adding or removing the sub tasks listed in the tasks YAML configuration.

Default

$ gulp

You can choose a different config by using --config paramter.

$ gulp --config another-config.yml

All tasks can run locally with ./node_modules/.bin/gulp taskname in the tasks table will be used gulp taskname to be easy to read.

$ ./node_modules/.bin/gulp --config another-config.yml --silent

Note: Tasks with --silent or -S flag will stop firing Gulp task logs, but you can miss errors not checked by dustman.


Watcher

If js.watch, css.watch and html.watch watched folder's files changes, the watcher will perform a new build.

$ gulp watch

The abbreviation command for watch is w

$ gulp w

Server + watcher

If js.watch, css.watch and html.watch watched folder's files changes, the watcher will perform a new build.

A server based on browser sync node module will serve the HTML templates.

$ gulp http

The abbreviation command for http is h

$ gulp h

Sub tasks

In the dustman.yml config, you can select the tasks (css, js or html) to be used to choose what will be built.

tasks:
  - css
  - js
#  - html # skip HTML tasks

Shell commands

You can run shell commands with shell parameters in config:

shell:
  before:
    - echo before build task command 01
    - echo before build task command 02
  after:
    - echo after build task command

JavaScript task file generator

If you use this YAML config:

js:
  file: dustman.min.js
  files:
    - my/js/development/file.js
  vendors:
    file: vendors.min.js
    merge: true
    files:
      - vendor/angular/angular.js

Dustman will generate these files:

dustman.min.js # [ dev files + vendors ]
dustman.no-vendors.min.js # [ dev files only ]
vendors.min.js # [ vendors only, used for caching vendors and skip its build time ]

If you use this YAML config:

js:
  file: dustman.min.js
  files:
    - my/js/development/file.js
  vendors:
    file: vendors.min.js
    merge: false
    files:
      - vendor/angular/angular.js

Dustman will generate these files:

dustman.min.js # [ dev files only ]
vendors.min.js # [ vendors only, will be generated only the first time ]

Config example

---

tasks:
  - css  # optional [skipped]
  - js   # optional [skipped]
  - html # optional [skipped]

config:
  autoprefixer: # optional [defaults]
    browsers:
      - last 3 versions
  csslint: csslintrc.json # optional [defaults]
  stylestats: .stylestatsrc # optional [defaults]
  prettify: # optional [defaults]
    indent_char: ' '
    indent_size: 2
  faker: # optional [defaults]
    locale: it
  twig: # optional [defaults]
    cache: false
  osNotifications: true # optional [true]
  emptyFolders: false # optional [true]
  polling: 500 # optional [false]
  verify: true # optional [false]
  verbose: 3 # optional [3]

css: # optional [required by sub task css if used]
  file: themes-with-vendors.min.css # optional [dustman.min.css]
  watch: my/sass/files/**/*.scss # optional [./**/*.scss]
  path: my/sass/path/ # optional [inherit path.css]
  themes:
    -
      name: theme-one # optional [theme-0]
      file: theme-one.css # optional [theme-0.css]
      compile: my/sass/files/theme-one/import.scss
      images: my/sass/files/themes/default/img/**/*.* # optional [skipped]
      fonts: my/sass/files/themes/default/img/**/*.* # optional [skipped]
      csslint: true # optional [false]
      path: my/sass/path/ # optional [inherit path.css]
      stylestats: true # optional [false]
      autoprefixer: true # optional [false]
    -
      name: theme-two # optional [theme-1]
      file: theme-two.css # optional [theme-1.css]
      compile: my/sass/files/theme-two/import.scss
      csslint: false # optional [false]
      stylestats: false # optional [false]
      autoprefixer: false # optional [false]
  vendors: # optional
    file: vendors.min.css
    merge: true  # optional [true]
    path: custom/path/ # optional [inherit path.css]
    files:
      - vendor/angular/angular-csp.css
      - vendor/angular-bootstrap/ui-bootstrap-csp.css
      - vendor/font-awesome/css/font-awesome.css
      - vendor/angular-chart.js/dist/angular-chart.css

js: # optional [required by sub task js if used]
  file: app-with-vendors.min.js # optional [dustman.min.js]
  watch: my/js/files/**/*.js # optional [./**/*.js]
  merge: true # optional [true]
  path: my/sass/path/ # optional [inherit path.js]
  files:
    - my/js/files/*
  vendors: # optional
    file: vendors.min.js
    path: custom/path/ # optional [inherit path.js]
    merge: true # optional [true]
    files:
      - vendor/angular/angular.js
      - vendor/angular-animate/angular-animate.js
      - vendor/angular-bootstrap/ui-bootstrap-tpls.js
      - vendor/angular-bootstrap/ui-bootstrap.js
      - vendor/Chart.js/Chart.js
      - vendor/angular-chart.js/dist/angular-chart.js
      - vendor/angular-cookies/angular-cookies.js
      - vendor/angular-dynamic-locale/dist/tmhDynamicLocale.js
      - vendor/angular-flash/angular-flash.js
      - vendor/angular-route/angular-route.js

shell: # optional [skipped]
  before: # optional [skipped]
    - echo before build task command 01
    - echo before build task command 02
  after: # optional [skipped]
    - echo after build task command

vendors: # optional [skipped]
  fonts: # optional [skipped]
    - vendor/font-awesome/fonts/fontawesome-webfont.eot
    - vendor/font-awesome/fonts/fontawesome-webfont.svg
    - vendor/font-awesome/fonts/fontawesome-webfont.ttf
    - vendor/font-awesome/fonts/fontawesome-webfont.woff
    - vendor/font-awesome/fonts/fontawesome-webfont.woff2
    - vendor/font-awesome/fonts/FontAwesome.otf
  images: # optional [skipped]
    - vendor/font-awesome/fonts/fontawesome-webfont.svg

html: # optional [required by sub task html if used]
  engine: twig # optional [html]
  fixtures: # optional [false]
    images: images.json
    foo: foo.json
  watch: test/examples/twig/**/*.twig
  files:
    - test/examples/twig/index.twig

paths:
  server: my/build/
  css: my/build/css/
  images: my/build/img/
  fonts: my/build/fonts/
  js: my/build/js/

Load a sub config file

Now it's possible to load config portions based on task type

---

tasks:
  - css
  - html
  - js

config: path/relative/to/this/config.yml
css: path/relative/to/this/config.yml
html: path/relative/to/this/config.yml
js: path/relative/to/this/config.yml
paths: path/relative/to/this/config.yml
vendors: path/relative/to/this/config.yml
shell: path/relative/to/this/config.yml

Config parameters

Config

Config parameters with links comes from related plug-in configurations

ParameterExample valueTypeDescription
configmixedObjectIt contains CSS options
config.autoprefixermixedObjectgulp-autoprefixer
config.csslintpath/csslintrc.jsonStringIt contains CSSlint options path
config.emptyFolderstrueBooleanDeletes file contents inside paths.server to keep the build clean
config.fakermixedObjecthttps://github.com/marak/Faker.js/
config.prettifymixedObjecthttps://www.npmjs.com/package/gulp-html-prettify
config.stylestatspath/.stylestatsrcStringIt contains Stylestats options path
config.twigmixedObjectgulp-twig
config.osNotificationstrueBooleanEnables OS desktop notifications
config.polling500mixedSet millisecs of polling to the Gulp watcher to prevent missing Vagrant NFS filesync with local system and VM, it's false by default
config.verbose3IntegerThe verbose value, 0: no messages, 3: all message logs
config.verifytrueBooleanChecks if all dustman generated files are created on the machine

CSS

ParameterExample valueTypeDescription
cssmixedObjectIt contains CSS options
css.filedustman.min.cssStringThe name of the merged and minified CSS with vendors and SASS or LESS themes
css.pathpath/to/css/StringIf this theme should be built in a specific folder
css.themesmixedArrayIt contains theme with it's config
css.themesmixedArrayIt contains theme object with it's config
css.themes[].autoprefixertrueBooleanIf the build will add prefixes to the CSS theme
css.themes[].compile-path/theme.sassStringPath to the CSS theme, can be SASS or LESS
css.themes[].csslinttrueBooleanIf theme need to be tested
css.themes[].filetheme-name.min.cssStringThe name of the single theme built
css.themes[].fontspath/__/.**StringFonts path related to theme
css.themes[].imagespath/__/.**StringImages path related to theme
css.themes[].mergetrueBooleanIf this theme should be in the final merged CSS file
css.themes[].nametheme-nameStringThe name will be listed in the build logs, based on config.verbose
css.themes[].pathpath/to/css/StringIf this theme should be built in a specific folder
css.themes[].stylestatstrueBooleanIf this theme is passed to stylestats report
css.vendorsmixedObjectIt contains CSS vendors options
css.vendors.filevendors.min.cssStringThe name of the merged and minified vendors CSS
css.vendors.mergetrueBooleanIf vendors will be merged into the final CSS file
css.vendors.files-vendors/file.cssArrayFiles listed for the merged CSS vendors build
css.watchpath/__/.js*StringFiles watched from the main task watcher

JavaScript

ParameterExample valueTypeDescription
jsmixedObjectIt contains JavaScript options
js.filedustman.min.jsStringThe name of the merged and minified JavaScript
js.pathpath/to/js/StringIf this theme should be built in a specific folder
js.watchpath/__/.js*StringFiles watched from the main task watcher
js.files-path/file.jsArrayFiles listed for the JavaScript build, it can also be a conatiner path like -path/app/*
js.vendorsmixedObjectIt contains CSS vendors options
js.vendors.filevendors.min.jsStringThe name of the merged and minified vendors JS
js.vendors.mergetrueBooleanIf vendors will be merged into the final JS file
js.vendors.files-vendors/file.cssArrayFiles listed for the merged JS vendors build

Paths

ParameterExample valueTypeDescription
pathsmixedObjectIt contains build path targets
paths.serverpath/to/html/StringPath where the Browser sync local server will point and Twig will be generated
paths.csspath/to/html/css/StringWhere CSS files will be moved from source targets to the production folders
paths.imagespath/to/html/images/StringWhere images files will be moved from source targets to the production folders
paths.fontspath/to/html/fonts/StringWhere fonts files will be moved from source targets to the production folders
paths.jspath/to/html/js/StringWhere js files will be moved from source targets to the production folders

Shell

Shell node module doesn't seems to support every command

ParameterExample valueTypeDescription
shellmixedObjectIt contains shell tasks options
shell.before-bash commandArrayBash commands will be executed in series before the build tasks
shell.after-bash commandArrayBash commands will be executed in series after the build tasks

Tasks

ParameterExample valueTypeDescription
tasks-cssArrayIt contains the sub tasks pipeline build sequence

You can add css, js and html

HTML

ParameterExample valueTypeDescription
htmlmixedObjectIt contains twig options
html.enginetwigStringThe engine used, Twig or HTML for now (html by default)
html.watchpath/__/.twig*StringFiles watched from the main task watcher
html.files-path/file.twigArrayFiles listed for the HTML build
html.fixturesmixedObjectA list of property which points to json files that will be loaded with the same property name, if you set fixtures.images to images.json in the twig you'll get json contents {{ fixtures.images[0].title }}

Vendors

ParameterExample valueTypeDescription
vendorsmixedObjectIt contains vendors options
vendors.fonts-vendors/font.ttfArrayFiles listed to be moved on fonts production folder
vendors.images-vendors/image.svgArrayFiles listed to be moved on images production folder

Previous release details

Release 1.10.X details

TypeDescription
fixSkips removing build folder if it's the first build process
fixCheck if emptyFolders is set to prevent removed vendors after the first build of the watcher
featureBuild folders are automatically emptied, can be skipped with confing.emptyFolders

Release 1.9.X details

TypeDescription
fixFixes fixtures path
optimizationNow you can load configs for config, paths, tasks, shell and vendors properties too
featureTWIG can load json fixtures

Release 1.8.X details

TypeDescription
featureConfig can load another config

Release 1.7.X details

TypeDescription
optimizationUpdates node packages
fixFix css task when not used
featureAdds moment to twig

Release 1.6.X details

TypeDescription
changeMoves to node_modules temp folders no-vendors.js file when built

Release 1.5.X details

TypeDescription
fixWrong polling settings if disabled
fixNow JS task can be with vendors only
fixAdds a missing warning if -S flag is passed to Gulp task
optimizationAdds abbreviation command for Gulp's http task, now can be called just with h
optimizationAdds abbreviation command for Gulp's watch task, now can be called just with w
fixCorrects a wrong file check on CSS task for verify task
fixEnsure CSS and JS tasks can be empty also on files verify task
fixEnsure HTML task can be empty also on files verify task
optimizationFiles list concatentation is more easy to read
optimizationAdds toString to message logs
optimizationAdds toString to path errors
optimizationNow vendors are disabled by default to ensure CSS and JS vendors to be optional
fixCSS and JS vendors now are optional
fixFix wrong file path on JS vendors save
featureAdds additional path properties to css and js tasks

Release 1.4.X details

TypeDescription
fixCheck between system node version and required version correctly
fixRemoved old task name twig for html to verify files correctly
optimizationAdd system node version check to notify if it's too old
optimizationAdd timed to important messages to be more easy to read
fixFix wrong task error for watched dustman folders
fixFix missing config file message
optimizationAdded missing vendors warning if it's thrown a file not found error
testAdded travis tests
featureAdded engine selection for HTML build

Release 1.3.X details

TypeDescription
featureAdded polling option to Gulp watcher to prevent missing Vagrant NFS filesync with local system and VM

Release 1.2.X details

TypeDescription
fixOptimized files verification to be of their relative task modules
coding standardRemove unused comments
fixFix shell tasks not started properly
featureNow it's possible to verify files built to ensure everything work as expected

Release 1.1.X details

TypeDescription
optimizationIf JS or CSS vendor files are removed they will be built again
fixFix wrong name notice log for fonts vendors
fixFix vendors assets always skipping from build
fixFix wrong default JavaScript path for vendors
fixDecommented missing minimized JavaScript files
optimizationTask logs are more consistent
optimizationCritical build speed improvement, with vendors cached after first build
changeChange how CSS and JavaScript vendors are built

Dustman is coded with love by vitto @ ideato

1.11.56

5 years ago

1.11.55

7 years ago

1.11.54

7 years ago

1.11.53

7 years ago

1.11.52

7 years ago

1.11.51

7 years ago

1.10.50

7 years ago

1.10.49

7 years ago

1.10.47

7 years ago

1.9.47

7 years ago

1.9.46

7 years ago

1.9.45

7 years ago

1.8.45

8 years ago

1.6.43

8 years ago

1.5.43

8 years ago

1.5.42

8 years ago

1.5.41

8 years ago

1.5.40

8 years ago

1.5.37

8 years ago

1.5.36

8 years ago

1.5.26

8 years ago

1.4.26

8 years ago

1.4.25

8 years ago

1.4.22

8 years ago

1.4.20

8 years ago

1.4.19

8 years ago

1.3.18

8 years ago

1.2.18

8 years ago

1.2.16

8 years ago

1.1.15

8 years ago

1.1.14

8 years ago

1.1.13

8 years ago

1.1.12

8 years ago

1.1.10

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.7.34

8 years ago

0.6.34

8 years ago

0.6.32

8 years ago

0.4.29

8 years ago

0.2.28

8 years ago

0.2.27

8 years ago

0.1.27

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.21

8 years ago

0.0.14

8 years ago

0.0.11

8 years ago