grunt-laxar Build Status

Grunt tasks for LaxarJS

grunt-laxar provides a couple of custom Grunt tasks for LaxarJS applications, plus matching default configuration for several tasks from the Grunt community.

$ grunt laxar-test laxar-build laxar-dist laxar-develop
        └─1──────┘ └─2───────┘ └─3──────┘ └─4─────────┘

  1) run widget tests
  2) generate required application artifacts, bring your own server
  3) generate an optimized version for production (may take a bit longer)
  4) do a build, then run a development server with live-reload of changes

Getting Started

This plugin requires Grunt ~0.4.4. In case you have not used Grunt before, be sure to have a look at its Getting Started guide.

To use this plugin, you first need to install it using npm:

$ npm install grunt-laxar

After that, load its tasks from your Gruntfile:

grunt.loadNpmTasks( 'grunt-laxar' );

Main Tasks

These are the bread-and-butter tasks for developing and optimizing your LaxarJS application. Usually, the only task that you will have to configure manually is laxar-configure.

These tasks form the public API for grunt-laxar, and any change in their configuration or end-result is subject to the semantic versioning of this package.

laxar-configure

Configures all flow-based tasks and their building blocks. This is the only task that requires manual configuration (more).

laxar-build

Generates all artifacts that are needed to develop your application on an existing web server (more).

laxar-develop

Generates dependencies and resource listings required by the LaxarJS runtime, and starts a development server with live reloading (more).

laxar-dist

Prepares your application for production (more).

laxar-test

Runs the spec tests of all widgets that are a direct part of the application (more).

laxar-test-widget

Runs the spec test of an individual widget (more).

laxar-info

Obtain information about the artifacts in your application (more).

laxar-dox

Create API documentation in Markdown format (more).

Internal Building-Block Tasks

These tasks are used under the hood by the main tasks listed above.

Usually you do not need to know the details on these tasks, but sometimes you can save a few seconds by only running the sub-tasks you need, instead of the whole toolchain. The APIs of these tasks and their intermediate output is considered internal, so that behavior may change in incompatible ways between minor versions of grunt-laxar.

All of these tasks are multitasks that must be configured once for each set of flows that they may handle. Thus, If your Gruntfile contains the laxar-configure settings given above, you would (re)create the artifacts model for the main flow by executing:

grunt laxar-configure laxar-artifacts:main

The easiest way to generate the required configuration is by running laxar-configure before launching any of these tasks. The main tasks listed above do that for you out of the box.

laxar-build-flow

For a given flow target, generates all artifacts that are needed to run that flow in the browser during development (more).

laxar-artifacts

For a given flow target, collects all reachable artifacts and produce an artifacts model in JSON format (more).

laxar-resources

For a given flow target, determines static assets (JSON, CSS, HTML) from the artifacts model in order to produce a resources listing in JSON format (more).

laxar-dependencies

For a given flow target, generates an AMD module that references all direct dependencies (more).

laxar-merge-require-config

For a given flow target, collects and merges all require_config.js files found in widgets and controls (more).

laxar-configure-watch

For a given flow target, generates configuration for watch targets (more).

laxar-dist-flow

For a given flow target, produces optimized assets (CSS, JavaScript) (more).

laxar-dist-js

For a given flow target, uses r.js to create an optimized JavaScript bundle (more).

laxar-dist-css

For a given flow target, uses clean-css (via cssmin) in order to create a single, optimized CSS file for each theme (more).

laxar-test-flow

For a given flow target, run all widget tests (more).

laxar-test-configure-flow

Prepares test-configuration for all widgets of the given flow (more).

laxar-test-widget-internal

Runs pre-configured widget tests (prepared by laxar-test-configure-flow or by laxar-test-widget) (more).

Deprecated Tasks

These tasks were originally available for LaxarJS v0.x and have similar objectives to the tasks listed above. Yhese tasks are kept for compatibility only, because they shipped with LaxarJS v1.0. It is recommended to instead use the tasks listed above, which are flow-aware and much less likely to cause CPU problems due to rampant watchers.

Third-Party Tasks

These tasks are automatically configured by grunt-laxar to work with a LaxarJS application. Starting with grunt-laxar v1.1.0, it is recommended not to use these tasks directly but to use the main tasks above. If using these tasks directly, try not to rely on the current pre-configuration performed by grunt-laxar. In the future, configuration for these tasks may be scoped to affect only specific named targets defined by grunt-laxar This way, configuration will not influence any (alias) tasks defined by yourself.

  • connect: Start a static web server.
  • jshint: Validate files with JSHint.
  • karma: Run Karma.
  • requirejs: Optimize RequireJS projects using r.js.
  • connect: Start a static web server.
  • watch: Run tasks whenever watched files change.