Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (45 sloc) 2.24 KB
title layout
Building Bolt Packages
default

Building Bolt Packages

Bolt includes a build system that allows you to generate single file packages for your css and js files. A package.json manifest tells the build script what files to include in your package.

Here is an example package.json file: {% highlight javascript %} { "name": "MyProjectName", "version": "1.0.0", "bolt_build_manifest":{ "provide_common_js_require_function": true, "sources": [ ["module_name", "path/to/module.js"], ["namespace", "../directory/outside/my/project"] "another_module.js" "a_directory" ], "package_target": "path/to/package/directory", "package_name": "my_package" }, { ... multiple configs can be provided in a single file } } {% endhighlight %}

Key points

  • all file references are relative to the location of the package.json
  • multiple configurations can be provided as a json array
  • provide_common_js_require_function should only be included by the bolt package. Eventually we may put everything into one package; however, for now it's important that only the bolt framework package includes this file
  • directory references in the package.json will cause all files to be recursively included within that directory.
  • if a namespace is provided in the sources (e.g. ["module_name", "directory"]) files within that directory will be required as require('module_name/path/to/file/from/directory.js').
  • any images in a directory you specify in sources will be copied into the package_target directory. This means your css files should be able to reference the images relatively as if they are alongside the css file.

Running bolt build
Once you run npm-link on your bolt checkout, you'll have access to the "bolt build" command. bolt build takes a few options:

  • -w : run the build continuously watching for changes to files
  • -c : specify an alternate config file other than the default package.json
  • -m: minify the output using uglify.js. package files will be names as package_name.min.js package_name.min.css

To see all of the tasks available to run in your project, type bolt tasks

Jump to Line
Something went wrong with that request. Please try again.