steal-export

  • typedef
grunt-steal.export {Object}  

A Grunt multi task that loads modules, and writes them out in different formats.

Object

Properties

  1. tasks {Object<String,ExportObject>}

    An object with task names as keys, and exportObjects as values.

    grunt.initConfig({
      "steal-export": {
        taskName1: { ExportObject1 },
        taskName2: { ExportObject2 }
      }
    });
    

    Each ExportObject specifies:

    • A steal object that specifies the modules to be loaded.
    • An options object that specifies any special loading behavior, like turning logging.
    • An outputs object that specifies how the modules should be written out.
    grunt.initConfig({
      "steal-export": {
        taskName: {
          steal : { .. },
          options: { .. },
          outputs: { .. }
        }
      }
    });
    

Use

Note: The steal-export Grunt task calls steal-tools.export internally. This page documents the specifics of the Grunt task. Read steal-tools.export's documentation for how to use the export in various workflows and detailed information on the steal and options arguments.

steal-export is a Grunt multi-task that is used to build library projects to a variety of formats. For example, to load a "main" module and transpile it, and all of its dependencies (except jQuery), to AMD and CommonJS with debug output:

grunt.initConfig({
  "steal-export": {
    transpile: {
      steal: {
        main: "main",
        config: __dirname + "/config.js"
      },
      options: {
        debug: true
      },
      outputs: {
        amd: {
          graphs: ["main"],
          format: "amd",
          ignore: ["jquery"]
        },
        cjs: {
          graphs: ["main"],
          format: "amd",
          ignore: ["jquery"]
        }
      }
    }
  }
});

Each ExportObject task is configured by three values:

  • steal - describes the config values used to load modules; this is passed to transformImport.
  • options - configures special behavior of the loader, such as logging.
  • outputs - configures the modules that should be written out, how they should be written out, and where they should be written.

The ExportObject documentation has more information.

meta.steal.export-helpers

You can add your own export helpers on your Grunt config's meta.steal.export-helpers object, as follows:

grunt.initConfig({
  meta: {
    steal: {
      "export-helpers": {
        "minify": {minify: true}
      }
    }
  },
  "steal-export": {
    transpile: {
      steal: { ... },
      outputs: {
        "amd +minify": {
          format: "amd"
        }
      }
    }
  }
})
Help us improve StealJS by taking our community survey