Build Step

Koala Framework now has a build/compile/generate step.

This got merged into master recently and will be part of verison 3.8.

Why?

With the build step we can use external tools we don't want to depend on on production locally:

  • libsass (for much faster (10x) sass to css compilation
  • uglifyjs (for proper minification of javascript assets)
  • sourcemaps generation (for sass, minified javascript and concated css & js)

Additionally we don't have to rebuild assets on every clear-cache on production servers which caused a downtime of (depending on the server) several minutes.

And one important point is performance - we now can rely on the existence of build files on production and don't have to lazy generate caches.

What?

Currently part of the build are:

  • asset packages (compiled, minified, concated assets)
  • trl (parsed trl.xml files ready for usage in Kwf_Trl, for improved performance)
  • component settings (all static component settings)
  • component events (event listeners aggregated from all components)

Usage

When running a Koala Framework Application you now need the build subfolder. Run the following command to generate it:

php bootstrap.php build

Dependencies

For a successful build several libraries node packages are required: 

  • node-sass (for compiling scss)
  • uglifyjs (for minifying js)
  • grunt-modernizr (for creating modernizr build)
But don't worry - all are installed automatically using composer-extra-assets.

Deployment to production

The idea behind the build is that you can share the generated files across servers. You should not build on production server, instead the locally build files should be copied to the production server.

Build Server

Creating a build Server is relatively easy as you just have download all dependencies and start the build. No database or local config required.

This entry was posted in Koala Framework by Niko Sams. Bookmark the permalink.

Leave a Reply

Your email address will not be published.

Github Activity

nsams commented on pull request koala-framework/koala-framework#713

@nsams
nsams commented on pull request koala-framework/koala-framework#713
Feb 7, 2018

noch eine verbesserungsidee: du könntest die subroot mitschleifen und bei ComponentClass_ContentChanged angeben

nsams commented on pull request koala-framework/koala-framework#712

@nsams
nsams commented on pull request koala-framework/koala-framework#712
Feb 6, 2018

hm, bin mir nicht sicher ob das eine gute idee ist wenn das immer so ist. Ein Statisches Activation mail hat doch auch seine vorteile - reden wir d…

nsams commented on pull request koala-framework/koala-framework#713

@nsams
nsams commented on pull request koala-framework/koala-framework#713
Feb 6, 2018

wofür ist das auskommentierte da, soll das später aktiviert werden oder so?

nsams commented on pull request koala-framework/koala-framework#713

@nsams
nsams commented on pull request koala-framework/koala-framework#713
Feb 6, 2018

evtl. nur wenn die column dirty ist wo die directory id drin steht?

nsams commented on pull request koala-framework/koala-framework#700

@nsams
nsams commented on pull request koala-framework/koala-framework#700
Feb 5, 2018

gibt es doch keinen 4.5 shop?