Skip to content

Incremental Builds

tburny edited this page Jan 18, 2017 · 4 revisions

For speeding up Pattern Lab, a new feature called incremental builds has been added in Patternlab Node 2.7.0. Instead of rebuilding the whole Pattern Lab tree, only changed patterns (and files including these) will be rebuilt.

  • Also an export to GraphViz has been added.
  • Pattern Lab will now print which patterns have been built yet, so correctness of the build can be verified.

Enabling/disabling incremental builds

The feature is enabled automatically when building Pattern Lab with the cleanPublic option set to false on the patternlab-config.json file found within editions.

Enabling/disabling GraphViz export

Setting the exportToGraphViz configuration option to true will export a graph showing which patterns include other patterns to public/dependencyGraph.dot. You can generate an SVG file via dot -Tsvg dependencyGraph.dot -o dependencyGraph.svg and open dependencyGraph.svg in your browser or favourite SVG viewer.

Possible issues

  • Pattern Lab remembers which patterns already have been compiled via the public/dependencyGraph.json file, which might eventually become out of sync. A quick fix is to clean the public directory. Deleting the file is not enough, because Pattern Lab will detect that the source files were not modified after the template output files in public.
  • patternDependencyGraph.json has an internal version. During Pattern Lab upgrades, the structure might change, which will trigger a full rebuild and a warning is shown.
  • When a file is renamed, moved or deleted, its previous output files are not deleted. As this is rarely the case during normal development, just do a full rebuild instead from time to time.
  • Changing a data.json file does not rebuild the whole patternlab. Temporarily use cleanPublic=true as a workaround.

Reporting problems

Please report any problems and ask questions to @tburny or the Pattern Lab team. Thanks!