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 starred symfony/symfony

Mar 24, 2017

nsams starred twigphp/Twig

Mar 24, 2017

nsams commented on issue koala-framework/koala-framework#520

Mar 24, 2017
@nsams

setTargetLanguage doesn't exist anymore but you can use Kwf_Trl::getInstance()->trl('Что-то', array(), 'en') instead

nsams commented on issue koala-framework/koala-framework#599

Mar 24, 2017
@nsams

The checked state of a checkbox is like the value of a textfield. It is loaded from the row the AutoForm is editing. When you create a new entry, t…

nsams opened pull request koala-framework/koala-framework#600

Mar 23, 2017
@nsams
PostRenderCutter: Don't comment out mask hide HTML
1 commit with 18 additions and 8 deletions